diff --git a/support/src/utils/file.cpp b/support/src/utils/file.cpp index 612a4b6..bbdadef 100644 --- a/support/src/utils/file.cpp +++ b/support/src/utils/file.cpp @@ -42,7 +42,15 @@ auto change_to_process_directory() -> bool { ::GetModuleFileNameA(nullptr, file_name.data(), static_cast(file_name.size() - 1U)); auto path = utils::path::get_parent_path(file_name.c_str()); - ::SetCurrentDirectoryA(path.c_str()); + auto res = ::SetCurrentDirectoryA(path.c_str()) != 0; + if (not res) { + throw utils::error::create_exception( + function_name, { + "failed to set current directory", + std::to_string(utils::get_last_error_code()), + path, + }); + } #else // !defined(_WIN32) std::string path; path.resize(PATH_MAX + 1);