diff options
author | Chun Kuan Lee <ken2812221@gmail.com> | 2018-08-06 01:03:33 +0000 |
---|---|---|
committer | Chun Kuan Lee <ken2812221@gmail.com> | 2018-08-27 03:24:34 +0800 |
commit | 23db9546c16c2be264cfc4f695f5738a2f5beeeb (patch) | |
tree | 116ce4c0c3d3724556118db8f39335bb20669845 /src | |
parent | 427253cf7e19ed9ef86b45457de41e345676c88e (diff) | |
download | bitcoin-23db9546c16c2be264cfc4f695f5738a2f5beeeb.tar.xz |
utils: run commands using utf-8 string on Windows
Diffstat (limited to 'src')
-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 1aab85264f..83690d6276 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> @@ -1135,7 +1136,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); } |