Skip to content

Commit 23db954

Browse files
committed
utils: run commands using utf-8 string on Windows
1 parent 427253c commit 23db954

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

src/util.cpp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,7 @@
5858
#ifndef NOMINMAX
5959
#define NOMINMAX
6060
#endif
61+
#include <codecvt>
6162

6263
#include <io.h> /* for _commit */
6364
#include <shlobj.h>
@@ -1135,7 +1136,11 @@ fs::path GetSpecialFolderPath(int nFolder, bool fCreate)
11351136
void runCommand(const std::string& strCommand)
11361137
{
11371138
if (strCommand.empty()) return;
1139+
#ifndef WIN32
11381140
int nErr = ::system(strCommand.c_str());
1141+
#else
1142+
int nErr = ::_wsystem(std::wstring_convert<std::codecvt_utf8_utf16<wchar_t>,wchar_t>().from_bytes(strCommand).c_str());
1143+
#endif
11391144
if (nErr)
11401145
LogPrintf("runCommand error: system(%s) returned %d\n", strCommand, nErr);
11411146
}

0 commit comments

Comments
 (0)