diff options
author | Wladimir J. van der Laan <laanwj@gmail.com> | 2018-09-12 11:20:56 +0200 |
---|---|---|
committer | Wladimir J. van der Laan <laanwj@gmail.com> | 2018-09-12 11:21:04 +0200 |
commit | 1c12cf60736c5a3ddf75244a0d61cda7f4ad5ed0 (patch) | |
tree | c306725352a5623eadcb221d99e335f91cd06bba /src/util.cpp | |
parent | 4103cc31690e5be21854a9628f57c54b880ee195 (diff) | |
parent | 23db9546c16c2be264cfc4f695f5738a2f5beeeb (diff) |
Merge #13886: utils: run commands using utf-8 string on Windows
23db9546c16c2be264cfc4f695f5738a2f5beeeb utils: run commands using utf-8 string on Windows (Chun Kuan Lee)
Pull request description:
Use unicode string to call commans
Tree-SHA512: 72f84e7b56cd947ad05176f10b5ddd5610f4641ba5e93ffd67777dea8f9734ec06e6ed3a63f67ae5e766767122c0dd2c441d0bad5572bdb9fb78758f02531feb
Diffstat (limited to 'src/util.cpp')
-rw-r--r-- | src/util.cpp | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/src/util.cpp b/src/util.cpp index 84a4adcfd4..20bdc5d0d8 100644 --- a/src/util.cpp +++ b/src/util.cpp @@ -58,6 +58,7 @@ #ifndef NOMINMAX #define NOMINMAX #endif +#include <codecvt> #include <io.h> /* for _commit */ #include <shlobj.h> @@ -1154,7 +1155,11 @@ fs::path GetSpecialFolderPath(int nFolder, bool fCreate) void runCommand(const std::string& strCommand) { if (strCommand.empty()) return; +#ifndef WIN32 int nErr = ::system(strCommand.c_str()); +#else + int nErr = ::_wsystem(std::wstring_convert<std::codecvt_utf8_utf16<wchar_t>,wchar_t>().from_bytes(strCommand).c_str()); +#endif if (nErr) LogPrintf("runCommand error: system(%s) returned %d\n", strCommand, nErr); } |