summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRagnar Thomsen <rthomsen6@gmail.com>2016-08-08 18:55:30 (GMT)
committerRagnar Thomsen <rthomsen6@gmail.com>2016-08-08 18:55:30 (GMT)
commit6e40c57ad2ba28b3eb1d4cbaf4d2c17350c00122 (patch)
tree2c821098bf52c46c58b4f30aafa94be9adaf1e7c
parent18916a4d1e19186eabb0f0ff3aa371018af6590d (diff)
Fix double slashes being added to destination path
-rw-r--r--kerfuffle/extractiondialog.cpp6
-rw-r--r--part/part.cpp11
2 files changed, 11 insertions, 6 deletions
diff --git a/kerfuffle/extractiondialog.cpp b/kerfuffle/extractiondialog.cpp
index a22bb8e..c87ef20 100644
--- a/kerfuffle/extractiondialog.cpp
+++ b/kerfuffle/extractiondialog.cpp
@@ -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 {
diff --git a/part/part.cpp b/part/part.cpp
index 1ea34e9..3a71679 100644
--- a/part/part.cpp
+++ b/part/part.cpp
@@ -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;