mirror of
https://github.com/microsoft/vcpkg.git
synced 2025-06-07 19:42:46 +08:00
vcpkg_from_git: append ssh bin directory to path
This commit is contained in:
parent
9b81b16c4c
commit
377ce3fae1
@ -40,7 +40,7 @@ namespace vcpkg::System
|
|||||||
|
|
||||||
const Environment& get_clean_environment();
|
const Environment& get_clean_environment();
|
||||||
Environment get_modified_clean_environment(const std::unordered_map<std::string, std::string>& extra_env,
|
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(const ZStringView cmd_line, const Environment& env = {});
|
||||||
int cmd_execute_clean(const ZStringView cmd_line);
|
int cmd_execute_clean(const ZStringView cmd_line);
|
||||||
|
@ -190,7 +190,7 @@ namespace vcpkg
|
|||||||
|
|
||||||
#if defined(_WIN32)
|
#if defined(_WIN32)
|
||||||
Environment System::get_modified_clean_environment(const std::unordered_map<std::string, std::string>& extra_env,
|
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_ROOT = get_environment_variable("SystemRoot").value_or_exit(VCPKG_LINE_INFO);
|
||||||
static const std::string SYSTEM_32 = SYSTEM_ROOT + R"(\system32)";
|
static const std::string SYSTEM_32 = SYSTEM_ROOT + R"(\system32)";
|
||||||
@ -291,6 +291,10 @@ namespace vcpkg
|
|||||||
|
|
||||||
if (extra_env.find("PATH") != extra_env.end())
|
if (extra_env.find("PATH") != extra_env.end())
|
||||||
new_path += Strings::format(";%s", extra_env.find("PATH")->second);
|
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.append(Strings::to_utf16(new_path));
|
||||||
env_cstr.push_back(L'\0');
|
env_cstr.push_back(L'\0');
|
||||||
env_cstr.append(L"VSLANG=1033");
|
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);
|
auto&& scfl = action.source_control_file_location.value_or_exit(VCPKG_LINE_INFO);
|
||||||
|
|
||||||
std::string prepend_to_path;
|
std::string prepend_to_path;
|
||||||
|
std::string append_to_path;
|
||||||
|
|
||||||
#if defined(_WIN32)
|
#if defined(_WIN32)
|
||||||
const fs::path& powershell_exe_path = paths.get_tool_exe("powershell-core");
|
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";
|
fs::path git_ssh_exe_path = git_ssh_search_path / "usr" / "bin" / "ssh.exe";
|
||||||
if (fs.exists(git_ssh_exe_path))
|
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;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -532,7 +533,7 @@ namespace vcpkg::Build
|
|||||||
|
|
||||||
const auto& env = build_env_cache.get_lazy({&base_env, build_env_cmd}, [&]() {
|
const auto& env = build_env_cache.get_lazy({&base_env, build_env_cmd}, [&]() {
|
||||||
auto clean_env =
|
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())
|
if (build_env_cmd.empty())
|
||||||
return clean_env;
|
return clean_env;
|
||||||
else
|
else
|
||||||
|
Loading…
Reference in New Issue
Block a user