diff options
| -rw-r--r-- | GUI/GUI/GUI/Config.cpp | 1 | ||||
| -rw-r--r-- | GUI/GUI/GUI/PythonWrapper.cpp | 22 |
2 files changed, 19 insertions, 4 deletions
diff --git a/GUI/GUI/GUI/Config.cpp b/GUI/GUI/GUI/Config.cpp index 6ef8bbd..35cbb0f 100644 --- a/GUI/GUI/GUI/Config.cpp +++ b/GUI/GUI/GUI/Config.cpp @@ -131,7 +131,6 @@ bool AppConfig::Deserialize(const std::filesystem::path& path) { std::error_code err;
if (!std::filesystem::exists(path, err)) {
*this = AppConfig(out_);
- Log(out_, "Cannot deserialize config at path {}: Does not exist!\n", path.string());
return true;
}
diff --git a/GUI/GUI/GUI/PythonWrapper.cpp b/GUI/GUI/GUI/PythonWrapper.cpp index 6c08fbe..05c3e48 100644 --- a/GUI/GUI/GUI/PythonWrapper.cpp +++ b/GUI/GUI/GUI/PythonWrapper.cpp @@ -183,7 +183,7 @@ bool PythonWrapper::InvokeCommandWithArgs(const std::string& cmd, std::string env; { - std::vector<char> buf(4096, 0); + std::vector<char> buf(4096 * 8, 0); DWORD len = GetEnvironmentVariableA("PATH", buf.data(), buf.size() - 1); if (len > 0) { env = std::string("PATH=") + buf.data(); @@ -195,7 +195,23 @@ bool PythonWrapper::InvokeCommandWithArgs(const std::string& cmd, out_cb("", err_oss.str()); return false; } - // TODO(yum) add git to PATH + + // Add git to PATH + std::filesystem::path git_path = + (std::filesystem::current_path() / + "Resources/PortableGit/bin").lexically_normal(); + if (env.find(git_path.string()) == std::string::npos) { + env += ";" + git_path.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 git to PATH: " << GetWin32ErrMsg() << std::endl; + out_cb("", err_oss.str()); + return false; + } + } } std::string cmd_str = cmd_oss.str(); @@ -206,7 +222,7 @@ bool PythonWrapper::InvokeCommandWithArgs(const std::string& cmd, TRUE, // whether to inherit parent's handles 0, // creation flags //env.data(), - nullptr, // env + nullptr, // environment variables std::filesystem::current_path().string().c_str(), // current directory &si, &pi)) { |
