设置当前工作目录为模块所在路径

This commit is contained in:
JIe 2024-11-07 18:53:34 +08:00
parent 7316c326d0
commit ab25935685

View File

@ -63,6 +63,11 @@ int main(int argc, char **) {
std::string filterComName;
std::string inputCommands;
std::stringstream oss;
char path_buffer[MAX_PATH + 1];
GetModuleFileName(nullptr, path_buffer, MAX_PATH);
(strrchr(path_buffer, '\\'))[0] = 0;
std::string path = path_buffer;
filesystem::current_path(path);
if (filesystem::exists("./config.toml")) {
const auto config = toml::parse("./config.toml");
filterComName = config.at("ComPorts").as_string();