mirror of
https://github.com/Retropex/bitcoin.git
synced 2025-05-28 13:02:38 +02:00
utils: run commands using utf-8 string on Windows
This commit is contained in:
parent
427253cf7e
commit
23db9546c1
@ -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);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user