Windows/msvc lockstep changes

This commit is contained in:
John McCardle 2023-02-26 07:51:03 -08:00
commit 6a47bc1e28
3 changed files with 27 additions and 1 deletions

View file

@ -12,10 +12,28 @@ std::wstring executable_path()
return exec_path.substr(0, path_index);
}
std::wstring executable_filename()
{
wchar_t buffer[MAX_PATH];
GetModuleFileName(NULL, buffer, MAX_PATH);
std::wstring exec_path = buffer;
return exec_path;
}
std::wstring working_path()
{
auto cwd = std::filesystem::current_path();
return cwd.wstring();
}
std::string narrow_string(std::wstring convertme)
{
//setup converter
using convert_type = std::codecvt_utf8<wchar_t>;
std::wstring_convert<convert_type, wchar_t> converter;
//use converter (.to_bytes: wstr->str, .from_bytes: str->wstr)
return converter.to_bytes(convertme);
}
#endif