|
|
|
@ -3594,8 +3594,17 @@ bool CPhoneDevice::OnImageReady(cv::Mat mat)
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
#endif // OUTPUT_DBG_INFO
|
|
|
|
|
bool imgExisted = std::filesystem::exists(std::filesystem::path(fullPath));
|
|
|
|
|
if (imgExisted)
|
|
|
|
|
{
|
|
|
|
|
size_t imgFileSize = getFileSize(fullPath);
|
|
|
|
|
if (imgFileSize == 0 || imgFileSize == (size_t)-1)
|
|
|
|
|
{
|
|
|
|
|
imgExisted = false;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (!std::filesystem::exists(std::filesystem::path(fullPath)) || getFileSize(fullPath) == 0)
|
|
|
|
|
if (!imgExisted)
|
|
|
|
|
{
|
|
|
|
|
bool res = cv::imwrite(fullPath.c_str(), mat, params);
|
|
|
|
|
if (!res)
|
|
|
|
@ -3854,7 +3863,16 @@ bool CPhoneDevice::PostProcessPhoto(const PHOTO_INFO& photoInfo, const vector<ID
|
|
|
|
|
bool res = false;
|
|
|
|
|
std::string fullPath = endsWith(path, ".jpg") ? path : (path + CTerminal::BuildPhotoFileName(photoInfo));
|
|
|
|
|
|
|
|
|
|
if (!std::filesystem::exists(std::filesystem::path(fullPath)) || getFileSize(fullPath) == 0)
|
|
|
|
|
bool imgExisted = std::filesystem::exists(std::filesystem::path(fullPath));
|
|
|
|
|
if (imgExisted)
|
|
|
|
|
{
|
|
|
|
|
size_t imgFileSize = getFileSize(fullPath);
|
|
|
|
|
if (imgFileSize == 0 || imgFileSize == (size_t)-1)
|
|
|
|
|
{
|
|
|
|
|
imgExisted = false;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
if (!imgExisted)
|
|
|
|
|
{
|
|
|
|
|
#ifdef _DEBUG
|
|
|
|
|
char log[256] = { 0 };
|
|
|
|
@ -3877,7 +3895,7 @@ bool CPhoneDevice::PostProcessPhoto(const PHOTO_INFO& photoInfo, const vector<ID
|
|
|
|
|
if (existsFile(tmpPath))
|
|
|
|
|
{
|
|
|
|
|
imgFileSize = getFileSize(tmpPath);
|
|
|
|
|
if (imgFileSize == 0)
|
|
|
|
|
if (imgFileSize == 0 || imgFileSize == -1)
|
|
|
|
|
{
|
|
|
|
|
XYLOG(XYLOG_SEVERITY_ERROR, "Empty File Written: %s errno=%d", tmpPath.c_str() + m_appPath.size(), errcode);
|
|
|
|
|
remove(tmpPath.c_str());
|
|
|
|
@ -3906,7 +3924,7 @@ bool CPhoneDevice::PostProcessPhoto(const PHOTO_INFO& photoInfo, const vector<ID
|
|
|
|
|
if (res)
|
|
|
|
|
{
|
|
|
|
|
imgFileSize = getFileSize(tmpPath);
|
|
|
|
|
if (imgFileSize == 0)
|
|
|
|
|
if (imgFileSize == 0 || imgFileSize == -1)
|
|
|
|
|
{
|
|
|
|
|
XYLOG(XYLOG_SEVERITY_ERROR, "Empty File after rename %s", fullPath.c_str() + m_appPath.size());
|
|
|
|
|
res = false;
|
|
|
|
|