diff options
Diffstat (limited to 'GUI/GUI/GUI/PythonWrapper.cpp')
| -rw-r--r-- | GUI/GUI/GUI/PythonWrapper.cpp | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/GUI/GUI/GUI/PythonWrapper.cpp b/GUI/GUI/GUI/PythonWrapper.cpp index ae0fa49..3a7cc5d 100644 --- a/GUI/GUI/GUI/PythonWrapper.cpp +++ b/GUI/GUI/GUI/PythonWrapper.cpp @@ -296,6 +296,24 @@ bool PythonWrapper::InvokeCommandWithArgs(const std::string& cmd, return false; } } + + // Add scripts to PATH + std::filesystem::path dll_bin = (std::filesystem::current_path() / + "Resources/Scripts").lexically_normal(); + if (env.find(dll_bin.string()) == std::string::npos) { + env += ";" + dll_bin.string(); + + // Add updated PATH to current process's environment + if (!SetEnvironmentVariableA("PATH", env.c_str())) { + std::ostringstream err_oss; + err_oss << "Error while executing python command \"" + << cmd_oss.str() + << "\": Failed to add python scripts to PATH: " + << GetWin32ErrMsg() << std::endl; + out_cb("", err_oss.str()); + return false; + } + } } std::string cmd_str = cmd_oss.str(); |
