From f1455fafae825936fd94412d162e60dcc79a7560 Mon Sep 17 00:00:00 2001 From: liyigang Date: Wed, 27 Dec 2023 20:56:10 +0800 Subject: [PATCH] fix:Copying a multi-layered directory with a long path to the mobile MTP, an error pops up Do special treatment Log:Copying a multi-layered directory with a long path to the mobile MTP, an error pops up Bug:https://pms.uniontech.com/bug-view-236225.html --- .../fileoperationutils/fileoperatebaseworker.cpp | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/plugins/common/core/dfmplugin-fileoperations/fileoperations/fileoperationutils/fileoperatebaseworker.cpp b/src/plugins/common/core/dfmplugin-fileoperations/fileoperations/fileoperationutils/fileoperatebaseworker.cpp index 43505d916f..6e42fb8f20 100644 --- a/src/plugins/common/core/dfmplugin-fileoperations/fileoperations/fileoperationutils/fileoperatebaseworker.cpp +++ b/src/plugins/common/core/dfmplugin-fileoperations/fileoperations/fileoperationutils/fileoperatebaseworker.cpp @@ -642,10 +642,15 @@ bool FileOperateBaseWorker::checkAndCopyDir(const FileInfoPointer &fromInfo, con action = AbstractJobHandler::SupportAction::kNoAction; if (localFileHandler->mkdir(toInfo->urlOf(UrlInfoType::kUrl))) break; + // 特殊处理 + auto errstr = localFileHandler->errorString(); + if (localFileHandler->errorCode() == DFMIOErrorCode::DFM_IO_ERROR_FAILED + && toInfo->pathOf(PathInfoType::kAbsoluteFilePath).toLocal8Bit().size() > 255) + errstr = tr("The file name or the path is too long!"); action = doHandleErrorAndWait(fromInfo->urlOf(UrlInfoType::kUrl), toInfo->urlOf(UrlInfoType::kUrl), AbstractJobHandler::JobErrorType::kMkdirError, true, - localFileHandler->errorString()); + errstr); } while (!isStopped() && action == AbstractJobHandler::SupportAction::kRetryAction); checkRetry();