diff options
author | dec05eba <dec05eba@protonmail.com> | 2018-10-27 17:54:13 +0200 |
---|---|---|
committer | dec05eba <dec05eba@protonmail.com> | 2020-07-06 07:39:33 +0200 |
commit | 0f3b3c10d63140509ebcd466b281a78e7f745225 (patch) | |
tree | 3e01fbe0025a5a9d6900a969bb7d87516028fb4d /src | |
parent | 1c6ab0b07f18f2c6919ebb45c40da1e00b7ecf83 (diff) |
Fix build for windows, release new windows build
Diffstat (limited to 'src')
-rw-r--r-- | src/FileUtil.cpp | 12 | ||||
-rw-r--r-- | src/GlobalLib.cpp | 4 | ||||
-rw-r--r-- | src/main.cpp | 8 |
3 files changed, 18 insertions, 6 deletions
diff --git a/src/FileUtil.cpp b/src/FileUtil.cpp index d33c94d..d07a074 100644 --- a/src/FileUtil.cpp +++ b/src/FileUtil.cpp @@ -54,6 +54,11 @@ namespace sibs { return FileString(utf8Str.data, utf8Str.data + utf8Str.size); } + + FileString toFileString(const char *str) + { + return str; + } #else std::string toUtf8(const sibs::FileString &input) { @@ -96,6 +101,13 @@ namespace sibs return result; } + FileString toFileString(const char *str) + { + FileString result; + utf8::utf8to16(str, str + strlen(str), std::back_inserter(result)); + return result; + } + FileString getLastErrorAsString() { DWORD errorMessageId = GetLastError(); diff --git a/src/GlobalLib.cpp b/src/GlobalLib.cpp index 2dd829f..7f9d949 100644 --- a/src/GlobalLib.cpp +++ b/src/GlobalLib.cpp @@ -278,7 +278,7 @@ namespace sibs libPath += TINYDIR_STRING("/.cache/sibs/lib/"); libPath += toFileString(dependency->name); libPath += TINYDIR_STRING("/"); - libPath += package.version.toString(); + libPath += toFileString(package.version.toString()); FileString libArchivedFilePath = libPathResult.unwrap(); libArchivedFilePath += TINYDIR_STRING("/.cache/sibs/archive/"); @@ -288,7 +288,7 @@ namespace sibs return createArchiveDirResult; libArchivedFilePath += TINYDIR_STRING("/"); - libArchivedFilePath += package.version.toString(); + libArchivedFilePath += toFileString(package.version.toString()); Result<bool> downloadResult = curl::downloadFile(package.urls[0].c_str(), libArchivedFilePath.c_str()); if(!downloadResult) return downloadResult; diff --git a/src/main.cpp b/src/main.cpp index 8e9cc00..a295eba 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -446,7 +446,7 @@ static int buildProject(int argc, const _tinydir_char_t **argv) OptimizationLevel optimizationLevel = OPT_LEV_NONE; FileString projectPath; bool sanitize = false; - const _tinydir_char_t *platformName = nullptr; + FileString platformName; for(int i = 0; i < argc; ++i) { @@ -484,7 +484,7 @@ static int buildProject(int argc, const _tinydir_char_t **argv) ++i; arg = argv[i]; - if(platformName) + if(!platformName.empty()) { ferr << "Error: Platform defined twice. First as " << platformName << " then as " << arg << endl; usageBuild(); @@ -510,8 +510,8 @@ static int buildProject(int argc, const _tinydir_char_t **argv) if(optimizationLevel == OPT_LEV_NONE) optimizationLevel = OPT_LEV_DEBUG; - if(!platformName) - platformName = asString(SYSTEM_PLATFORM); + if(platformName.empty()) + platformName = toFileString(asString(SYSTEM_PLATFORM)); string platformUtf8 = toUtf8(platformName); Platform platform = getPlatformByName(StringView(platformUtf8.data(), platformUtf8.size())); |