From 458bfcec79e76b927414ed1b2151a4d59503ff86 Mon Sep 17 00:00:00 2001 From: Alexander Tkachev Date: Mon, 4 Jul 2016 17:26:16 +0600 Subject: GUI: Fix DownloadDialog path creation Was adding a path separator even when none is required. --- gui/downloaddialog.cpp | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) (limited to 'gui') diff --git a/gui/downloaddialog.cpp b/gui/downloaddialog.cpp index 28a29fcb64..05d87c21d8 100644 --- a/gui/downloaddialog.cpp +++ b/gui/downloaddialog.cpp @@ -137,13 +137,15 @@ void DownloadDialog::selectDirectories() { Common::String localPath = dir.getPath(); //simple heuristic to determine which path separator to use - int backslashes = 0; - for (uint32 i = 0; i < localPath.size(); ++i) - if (localPath[i] == '/') --backslashes; - else if (localPath[i] == '\\') ++backslashes; - - if (backslashes > 0) localPath += '\\' + remoteDirectory.name(); - else localPath += '/' + remoteDirectory.name(); + if (localPath.size() && localPath.lastChar() != '/' && localPath.lastChar() != '\\') { + int backslashes = 0; + for (uint32 i = 0; i < localPath.size(); ++i) + if (localPath[i] == '/') --backslashes; + else if (localPath[i] == '\\') ++backslashes; + + if (backslashes > 0) localPath += '\\' + remoteDirectory.name(); + else localPath += '/' + remoteDirectory.name(); + } else localPath += remoteDirectory.name(); CloudMan.startDownload(remoteDirectory.path(), localPath); CloudMan.setDownloadTarget(this); -- cgit v1.2.3