diff --git a/3rdparty/interface/archiveinterface/cliinterface.cpp b/3rdparty/interface/archiveinterface/cliinterface.cpp index 177a9ef4..d5f40a16 100644 --- a/3rdparty/interface/archiveinterface/cliinterface.cpp +++ b/3rdparty/interface/archiveinterface/cliinterface.cpp @@ -195,6 +195,14 @@ PluginFinishType CliInterface::extractFiles(const QList &files, const } } } + + if (bHandleLongName && !checkMoveCapability()) { + qWarning() << "Long filename detected, but moveProgram (" << m_cliProps->property("moveProgram").toString() << ") is not available."; + qWarning() << "Archive format:" << m_mimetype.name() << "Skipping long name handling."; + qWarning() << "The extraction tool will report errors for files with names exceeding system limit (255 bytes)."; + bHandleLongName = false; + } + if (destPath.startsWith("/tmp") && destPath.contains("/deepin-compressor-")) { // 打开解压列表文件 if (!QDir(destPath).exists()) { QDir(destPath).mkpath(destPath); @@ -236,6 +244,7 @@ PluginFinishType CliInterface::extractFiles(const QList &files, const } else { password = options.password; } + if (!bLnfs) { for (QMap::const_iterator iter = arcData.mapFileEntry.begin(); iter != arcData.mapFileEntry.end(); iter++) { if (NAME_MAX < iter.value().strFileName.toLocal8Bit().length()) { @@ -244,6 +253,14 @@ PluginFinishType CliInterface::extractFiles(const QList &files, const } } } + + if (bHandleLongName && !checkMoveCapability()) { + qWarning() << "Long filename detected, but moveProgram (" << m_cliProps->property("moveProgram").toString() << ") is not available."; + qWarning() << "Archive format:" << m_mimetype.name() << "Skipping long name handling."; + qWarning() << "The extraction tool will report errors for files with names exceeding system limit (255 bytes)."; + bHandleLongName = false; + } + if (bHandleLongName) { if (!handleLongNameExtract(arcData.mapFileEntry.values())) { m_eErrorType = ET_FileWriteError; @@ -1098,6 +1115,17 @@ bool CliInterface::moveExtractTempFilesToDest(const QList &files, con return moveSuccess; } +bool CliInterface::checkMoveCapability() +{ + bool hasMoveCapability = false; + QString moveProgram = m_cliProps->property("moveProgram").toString(); + if (!moveProgram.isEmpty()) { + QString moveProgramPath = QStandardPaths::findExecutable(moveProgram); + hasMoveCapability = !moveProgramPath.isEmpty(); + } + return hasMoveCapability; +} + void CliInterface::removeExtractedFilesOnFailure(const QString &strTargetPath, const QList &entries) { QList listToRemove = entries; diff --git a/3rdparty/interface/archiveinterface/cliinterface.h b/3rdparty/interface/archiveinterface/cliinterface.h index 8b934e40..64913354 100644 --- a/3rdparty/interface/archiveinterface/cliinterface.h +++ b/3rdparty/interface/archiveinterface/cliinterface.h @@ -202,6 +202,8 @@ class CliInterface : public ReadWriteArchiveInterface bool handleLongNameExtract(const QList &files); + bool checkMoveCapability(); + private slots: /** * @brief readStdout 读取命令行输出