build: Updated libwolv

This commit is contained in:
WerWolv
2025-02-11 23:05:25 +01:00
parent b3d208e6e6
commit a83610bc06
4 changed files with 20 additions and 12 deletions

View File

@@ -40,16 +40,20 @@ namespace hex::init {
// On Windows, argv contains UTF-16 encoded strings, so we need to convert them to UTF-8
auto convertedCommandLine = ::CommandLineToArgvW(::GetCommandLineW(), &argc);
if (convertedCommandLine == nullptr) {
log::error("Failed to convert command line arguments to UTF-8");
log::error("Failed to get command line arguments");
std::exit(EXIT_FAILURE);
}
// Skip the first argument (the executable path) and convert the rest to a vector of UTF-8 strings
for (int i = 1; i < argc; i += 1) {
std::wstring wcharArg = convertedCommandLine[i];
std::string utf8Arg = wolv::util::wstringToUtf8(wcharArg);
auto utf8Arg = wolv::util::wstringToUtf8(wcharArg);
if (!utf8Arg.has_value()) {
log::error("Failed to convert command line arguments to UTF-8");
std::exit(EXIT_FAILURE);
}
args.push_back(utf8Arg);
args.push_back(*utf8Arg);
}
::LocalFree(convertedCommandLine);