epee: fix string_tools on Windows

This commit is contained in:
0xFFFC0000 2025-04-22 13:22:02 +00:00
parent 3b01c49095
commit 9891fe8238

View file

@ -153,10 +153,14 @@ namespace string_tools
void set_module_name_and_folder(const std::string& path_to_process_)
{
boost::filesystem::path path_to_process = path_to_process_;
boost::filesystem::path path_to_process;
#ifdef _WIN32
path_to_process = get_current_module_path();
// Convert to wide string to avoid codecvt errors with Unicode paths
std::wstring wpath = epee::string_tools::utf8_to_utf16(get_current_module_path());
path_to_process = boost::filesystem::path(wpath);
#else
path_to_process = boost::filesystem::path(path_to_process_);
#endif
get_current_module_name() = path_to_process.filename().string();