文件移动失败时,尝试9次
This commit is contained in:
parent
027f627365
commit
8c1474ab3d
|
@ -1183,6 +1183,7 @@ Twpp::Result huagao_ds::imageFileXferGet(const Twpp::Identity& origin)
|
|||
DeleteFileA(file.c_str());
|
||||
}
|
||||
|
||||
int cv_e = 0;
|
||||
if (ret.status() == ConditionCode::Success && m_fileXfer.format() != ImageFileFormat::Bmp)
|
||||
{
|
||||
SANE_ImageFormatConvert conv;
|
||||
|
@ -1202,16 +1203,25 @@ Twpp::Result huagao_ds::imageFileXferGet(const Twpp::Identity& origin)
|
|||
conv.dst.is_file = SANE_TRUE;
|
||||
conv.dst.data = target.c_str();
|
||||
conv.dst.data_len = target.length();
|
||||
MoveFileA(target.c_str(), file.c_str());
|
||||
if(scanner_->convert_image(&conv) != SCANNER_ERR_OK)
|
||||
ret = { ReturnCode::Failure, ConditionCode::OperationError };
|
||||
DeleteFileA(file.c_str());
|
||||
while (!MoveFileA(target.c_str(), file.c_str()))
|
||||
{
|
||||
if (++cv_e >= 9)
|
||||
break;
|
||||
Sleep(30);
|
||||
}
|
||||
if (cv_e < 9)
|
||||
{
|
||||
cv_e = scanner_->convert_image(&conv);
|
||||
if (cv_e != SCANNER_ERR_OK)
|
||||
ret = { ReturnCode::Failure, ConditionCode::OperationError };
|
||||
DeleteFileA(file.c_str());
|
||||
}
|
||||
}
|
||||
|
||||
{
|
||||
std::wstring info(load_sane_util::ansi2unic(m_fileXfer.filePath().string().c_str()));
|
||||
wchar_t r[80] = { 0 };
|
||||
swprintf_s(r, _countof(r) - 1, L": result = %d\r\n", ret.returnCode());
|
||||
swprintf_s(r, _countof(r) - 1, L": status = %d(convert: 0x%x)\r\n", ret.status(), cv_e);
|
||||
load_sane_util::log_info((info + r).c_str(), 0);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue