Commit 6e40c57a authored by Ragnar Thomsen's avatar Ragnar Thomsen
Browse files

Fix double slashes being added to destination path

parent 18916a4d
......@@ -274,7 +274,11 @@ QUrl ExtractionDialog::destinationDirectory() const
{
if (extractToSubfolder()) {
QUrl subUrl = fileWidget->baseUrl();
subUrl.setPath(subUrl.path() + QLatin1Char('/') + subfolder());
if (subUrl.path().endsWith(QDir::separator())) {
subUrl.setPath(subUrl.path() + subfolder());
} else {
subUrl.setPath(subUrl.path() + QDir::separator() + subfolder());
}
return subUrl;
} else {
......
......@@ -602,21 +602,22 @@ void Part::slotQuickExtractFiles(QAction *triggeredAction)
// #190507: triggeredAction->data.isNull() means it's the "Extract to..."
// action, and we do not want it to run here
if (!triggeredAction->data().isNull()) {
const QString userDestination = triggeredAction->data().toString();
qCDebug(ARK) << "Extract to user dest" << userDestination;
QString userDestination = triggeredAction->data().toString();
QString finalDestinationDirectory;
const QString detectedSubfolder = detectSubfolder();
qCDebug(ARK) << "Detected subfolder" << detectedSubfolder;
if (!isSingleFolderArchive()) {
finalDestinationDirectory = userDestination +
QDir::separator() + detectedSubfolder;
if (!userDestination.endsWith(QDir::separator())) {
userDestination.append(QDir::separator());
}
finalDestinationDirectory = userDestination + detectedSubfolder;
QDir(userDestination).mkdir(detectedSubfolder);
} else {
finalDestinationDirectory = userDestination;
}
qCDebug(ARK) << "Extract to final dest" << finalDestinationDirectory;
qCDebug(ARK) << "Extracting to:" << finalDestinationDirectory;
Kerfuffle::ExtractionOptions options;
options[QStringLiteral("PreservePaths")] = true;
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment