vcpkg_from_git: append ssh bin directory to path

This commit is contained in:
Marc Boucek 2020-03-14 17:03:47 +01:00
Родитель 9b81b16c4c
Коммит 377ce3fae1
3 изменённых файлов: 9 добавлений и 4 удалений

Просмотреть файл

@ -40,7 +40,7 @@ namespace vcpkg::System
const Environment& get_clean_environment();
Environment get_modified_clean_environment(const std::unordered_map<std::string, std::string>& extra_env,
const std::string& prepend_to_path = {});
const std::string& prepend_to_path = {}, const std::string& append_to_path = {});
int cmd_execute(const ZStringView cmd_line, const Environment& env = {});
int cmd_execute_clean(const ZStringView cmd_line);

Просмотреть файл

@ -190,7 +190,7 @@ namespace vcpkg
#if defined(_WIN32)
Environment System::get_modified_clean_environment(const std::unordered_map<std::string, std::string>& extra_env,
const std::string& prepend_to_path)
const std::string& prepend_to_path, const std::string& append_to_path)
{
static const std::string SYSTEM_ROOT = get_environment_variable("SystemRoot").value_or_exit(VCPKG_LINE_INFO);
static const std::string SYSTEM_32 = SYSTEM_ROOT + R"(\system32)";
@ -291,6 +291,10 @@ namespace vcpkg
if (extra_env.find("PATH") != extra_env.end())
new_path += Strings::format(";%s", extra_env.find("PATH")->second);
if(!append_to_path.empty())
new_path += Strings::format(";%s", append_to_path);
env_cstr.append(Strings::to_utf16(new_path));
env_cstr.push_back(L'\0');
env_cstr.append(L"VSLANG=1033");

Просмотреть файл

@ -470,6 +470,7 @@ namespace vcpkg::Build
auto&& scfl = action.source_control_file_location.value_or_exit(VCPKG_LINE_INFO);
std::string prepend_to_path;
std::string append_to_path;
#if defined(_WIN32)
const fs::path& powershell_exe_path = paths.get_tool_exe("powershell-core");
@ -489,7 +490,7 @@ namespace vcpkg::Build
fs::path git_ssh_exe_path = git_ssh_search_path / "usr" / "bin" / "ssh.exe";
if (fs.exists(git_ssh_exe_path))
{
prepend_to_path += git_ssh_exe_path.parent_path().u8string() + ";";
append_to_path += git_ssh_exe_path.parent_path().u8string() + ";";
break;
}
}
@ -532,7 +533,7 @@ namespace vcpkg::Build
const auto& env = build_env_cache.get_lazy({&base_env, build_env_cmd}, [&]() {
auto clean_env =
System::get_modified_clean_environment(base_env, prepend_to_path);
System::get_modified_clean_environment(base_env, prepend_to_path, append_to_path);
if (build_env_cmd.empty())
return clean_env;
else