diff options
author | Andrei Karas <akaras@inbox.ru> | 2017-04-15 20:17:18 +0300 |
---|---|---|
committer | Andrei Karas <akaras@inbox.ru> | 2017-04-15 20:17:18 +0300 |
commit | 482981410f52fff5b3e721bd51ce31c118bdaeaf (patch) | |
tree | dbb2e80d62763ed1977a96ad549310c5a28230e3 /src | |
parent | 820fc2d2509cda0648ceb33a860e25249b633bb8 (diff) | |
download | manaverse-1.7.4.15.tar.gz manaverse-1.7.4.15.tar.bz2 manaverse-1.7.4.15.tar.xz manaverse-1.7.4.15.zip |
Fix download urls on windows.v1.7.4.15
Diffstat (limited to 'src')
-rw-r--r-- | src/gui/windows/updaterwindow.cpp | 2 | ||||
-rw-r--r-- | src/utils/stringutils.cpp | 37 | ||||
-rw-r--r-- | src/utils/stringutils.h | 3 |
3 files changed, 41 insertions, 1 deletions
diff --git a/src/gui/windows/updaterwindow.cpp b/src/gui/windows/updaterwindow.cpp index f80f2dd99..13e16627d 100644 --- a/src/gui/windows/updaterwindow.cpp +++ b/src/gui/windows/updaterwindow.cpp @@ -596,7 +596,7 @@ void UpdaterWindow::download() else { mDownload = new Net::Download(this, - pathJoin(mUpdateHost, mCurrentFile), + urlJoin(mUpdateHost, mCurrentFile), &updateProgress, false, false, mValidateXml); diff --git a/src/utils/stringutils.cpp b/src/utils/stringutils.cpp index 5a343cdbd..90d5835a5 100644 --- a/src/utils/stringutils.cpp +++ b/src/utils/stringutils.cpp @@ -1143,6 +1143,43 @@ std::string pathJoin(std::string str1, } } +std::string urlJoin(std::string str1, + const std::string &str2) +{ + const char sep = '/'; + std::string sepStr = "/"; + + if (str1.empty()) + { + if (str2[0] == sep) + return str2; + else + return sepStr.append(str2); + } + const size_t sz1 = str1.size(); + if (str2.empty()) + { + if (str1[sz1 - 1] == sep) + return str1; + else + return str1.append(sepStr); + } + if (str1[sz1 - 1] == sep) + { + if (str2[0] == sep) + return str1.append(str2.substr(1)); + else + return str1.append(str2); + } + else + { + if (str2[0] == sep) + return str1.append(str2); + else + return str1.append(sepStr).append(str2); + } +} + #ifndef DYECMD void replaceItemLinks(std::string &msg) { diff --git a/src/utils/stringutils.h b/src/utils/stringutils.h index 02113d4c2..545734a56 100644 --- a/src/utils/stringutils.h +++ b/src/utils/stringutils.h @@ -282,4 +282,7 @@ std::string pathJoin(std::string str1, const std::string &str2, const std::string &str3); +std::string urlJoin(std::string str1, + const std::string &str2); + #endif // UTILS_STRINGUTILS_H |