Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 28 additions & 0 deletions 3rdparty/interface/archiveinterface/cliinterface.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -195,6 +195,14 @@ PluginFinishType CliInterface::extractFiles(const QList<FileEntry> &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);
Expand Down Expand Up @@ -236,6 +244,7 @@ PluginFinishType CliInterface::extractFiles(const QList<FileEntry> &files, const
} else {
password = options.password;
}

if (!bLnfs) {
for (QMap<QString, FileEntry>::const_iterator iter = arcData.mapFileEntry.begin(); iter != arcData.mapFileEntry.end(); iter++) {
if (NAME_MAX < iter.value().strFileName.toLocal8Bit().length()) {
Expand All @@ -244,6 +253,14 @@ PluginFinishType CliInterface::extractFiles(const QList<FileEntry> &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;
Expand Down Expand Up @@ -1098,6 +1115,17 @@ bool CliInterface::moveExtractTempFilesToDest(const QList<FileEntry> &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<FileEntry> &entries)
{
QList<FileEntry> listToRemove = entries;
Expand Down
2 changes: 2 additions & 0 deletions 3rdparty/interface/archiveinterface/cliinterface.h
Original file line number Diff line number Diff line change
Expand Up @@ -202,6 +202,8 @@ class CliInterface : public ReadWriteArchiveInterface

bool handleLongNameExtract(const QList<FileEntry> &files);

bool checkMoveCapability();

private slots:
/**
* @brief readStdout 读取命令行输出
Expand Down