diff options
| author | Alexander Karatarakis <alkarata@microsoft.com> | 2017-01-23 17:24:34 -0800 |
|---|---|---|
| committer | Alexander Karatarakis <alkarata@microsoft.com> | 2017-01-23 17:24:34 -0800 |
| commit | 4e86b01a36cba7a1e1b883a8d62a6f68c2b6e030 (patch) | |
| tree | 67afb6cc572bd232af654086cba4344b7fbb80d7 /toolsrc/src/vcpkg_Environment.cpp | |
| parent | 522b393901638c3abfc89ff63085ec64367c7671 (diff) | |
| download | vcpkg-4e86b01a36cba7a1e1b883a8d62a6f68c2b6e030.tar.gz vcpkg-4e86b01a36cba7a1e1b883a8d62a6f68c2b6e030.zip | |
[Environemnt] Don't depend on present working dir
Diffstat (limited to 'toolsrc/src/vcpkg_Environment.cpp')
| -rw-r--r-- | toolsrc/src/vcpkg_Environment.cpp | 17 |
1 files changed, 13 insertions, 4 deletions
diff --git a/toolsrc/src/vcpkg_Environment.cpp b/toolsrc/src/vcpkg_Environment.cpp index e1eb22969..22a9252b0 100644 --- a/toolsrc/src/vcpkg_Environment.cpp +++ b/toolsrc/src/vcpkg_Environment.cpp @@ -14,7 +14,7 @@ namespace vcpkg::Environment static const fs::path default_git_installation_dir = "C:/Program Files/git/cmd"; static const fs::path default_git_installation_dir_x86 = "C:/Program Files (x86)/git/cmd"; - static void ensure_on_path(const std::array<int, 3>& version, const wchar_t* version_check_cmd, const wchar_t* install_cmd) + static void ensure_on_path(const std::array<int, 3>& version, const std::wstring& version_check_cmd, const std::wstring& install_cmd) { System::exit_code_and_output ec_data = System::cmd_execute_and_capture_output(version_check_cmd); if (ec_data.exit_code == 0) @@ -57,8 +57,11 @@ namespace vcpkg::Environment _wputenv_s(L"PATH", path_buf.c_str()); static constexpr std::array<int, 3> git_version = {2,0,0}; + static const std::wstring version_check_cmd = L"git --version 2>&1"; + const fs::path script = paths.scripts / "fetchDependency.ps1"; // TODO: switch out ExecutionPolicy Bypass with "Remove Mark Of The Web" code and restore RemoteSigned - ensure_on_path(git_version, L"git --version 2>&1", L"powershell -ExecutionPolicy Bypass scripts\\fetchDependency.ps1 -Dependency git"); + const std::wstring install_cmd = Strings::wformat(L"powershell -ExecutionPolicy Bypass %s -Dependency git", script.native()); + ensure_on_path(git_version, version_check_cmd, install_cmd); } void ensure_cmake_on_path(const vcpkg_paths& paths) @@ -72,8 +75,11 @@ namespace vcpkg::Environment _wputenv_s(L"PATH", path_buf.c_str()); static constexpr std::array<int, 3> cmake_version = {3,7,2}; + static const std::wstring version_check_cmd = L"cmake --version 2>&1"; + const fs::path script = paths.scripts / "fetchDependency.ps1"; // TODO: switch out ExecutionPolicy Bypass with "Remove Mark Of The Web" code and restore RemoteSigned - ensure_on_path(cmake_version, L"cmake --version 2>&1", L"powershell -ExecutionPolicy Bypass scripts\\fetchDependency.ps1 -Dependency cmake"); + const std::wstring install_cmd = Strings::wformat(L"powershell -ExecutionPolicy Bypass %s -Dependency cmake", script.native()); + ensure_on_path(cmake_version, version_check_cmd, install_cmd); } void ensure_nuget_on_path(const vcpkg_paths& paths) @@ -82,8 +88,11 @@ namespace vcpkg::Environment _wputenv_s(L"PATH", path_buf.c_str()); static constexpr std::array<int, 3> nuget_version = {1,0,0}; + static const std::wstring version_check_cmd = L"nuget 2>&1"; + const fs::path script = paths.scripts / "fetchDependency.ps1"; // TODO: switch out ExecutionPolicy Bypass with "Remove Mark Of The Web" code and restore RemoteSigned - ensure_on_path(nuget_version, L"nuget 2>&1", L"powershell -ExecutionPolicy Bypass scripts\\fetchDependency.ps1 -Dependency nuget"); + const std::wstring install_cmd = Strings::wformat(L"powershell -ExecutionPolicy Bypass %s -Dependency nuget", script.native()); + ensure_on_path(nuget_version, version_check_cmd, install_cmd); } static std::vector<std::string> get_VS2017_installation_instances(const vcpkg_paths& paths) |
