From 551999be486054ba61068dc1081f7bf320910be3 Mon Sep 17 00:00:00 2001 From: Yukino Song Date: Sun, 27 Oct 2024 02:46:21 +0800 Subject: [PATCH] Maybe resolves #84 --- src/platform/windows/misc.cpp | 4 ++-- src/process.cpp | 1 + 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/src/platform/windows/misc.cpp b/src/platform/windows/misc.cpp index 3116bb77..b356769a 100644 --- a/src/platform/windows/misc.cpp +++ b/src/platform/windows/misc.cpp @@ -1848,7 +1848,7 @@ namespace platf { } // Get the output size required to store the string - auto output_size = MultiByteToWideChar(CP_UTF8, MB_ERR_INVALID_CHARS, string.data(), string.size(), nullptr, 0); + auto output_size = MultiByteToWideChar(CP_UTF8, 0, string.data(), string.size(), nullptr, 0); if (output_size == 0) { auto winerr = GetLastError(); BOOST_LOG(error) << "Failed to get UTF-16 buffer size: "sv << winerr; @@ -1857,7 +1857,7 @@ namespace platf { // Perform the conversion std::wstring output(output_size, L'\0'); - output_size = MultiByteToWideChar(CP_UTF8, MB_ERR_INVALID_CHARS, string.data(), string.size(), output.data(), output.size()); + output_size = MultiByteToWideChar(CP_UTF8, 0, string.data(), string.size(), output.data(), output.size()); if (output_size == 0) { auto winerr = GetLastError(); BOOST_LOG(error) << "Failed to convert string to UTF-16: "sv << winerr; diff --git a/src/process.cpp b/src/process.cpp index b4e77f83..cd8b0d7c 100644 --- a/src/process.cpp +++ b/src/process.cpp @@ -966,6 +966,7 @@ namespace proc { // when it contains spaces. Unlike POSIX, Windows forbids quotes in paths, // so we can safely strip them all out here to avoid confusing the user. boost::erase_all(ctx.working_dir, "\""); + ctx.working_dir += '\\'; #endif }