aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRobert Schumacher <roschuma@microsoft.com>2017-03-31 17:24:45 -0700
committerAlexander Karatarakis <alkarata@microsoft.com>2017-03-31 17:35:38 -0700
commitc84765601bbe49a6ec2e252ec681fe843212230f (patch)
tree0a67514bdbff13d6b142d6657c542b62076555ad
parenta6aa410f9fb7855b9cc94bae00d15fea8018250e (diff)
downloadvcpkg-c84765601bbe49a6ec2e252ec681fe843212230f.tar.gz
vcpkg-c84765601bbe49a6ec2e252ec681fe843212230f.zip
Move Environment::get_program_files() to System::get_program_files()
-rw-r--r--toolsrc/include/vcpkg_Environment.h4
-rw-r--r--toolsrc/include/vcpkg_System.h6
-rw-r--r--toolsrc/src/commands_edit.cpp3
-rw-r--r--toolsrc/src/commands_integrate.cpp6
-rw-r--r--toolsrc/src/vcpkg_Environment.cpp34
-rw-r--r--toolsrc/src/vcpkg_System.cpp34
-rw-r--r--toolsrc/src/vcpkg_paths.cpp10
7 files changed, 48 insertions, 49 deletions
diff --git a/toolsrc/include/vcpkg_Environment.h b/toolsrc/include/vcpkg_Environment.h
index 5d12c8f6c..32ab28391 100644
--- a/toolsrc/include/vcpkg_Environment.h
+++ b/toolsrc/include/vcpkg_Environment.h
@@ -12,8 +12,4 @@ namespace vcpkg::Environment
};
const vcvarsall_and_platform_toolset& get_vcvarsall_bat(const vcpkg_paths& paths);
-
- const fs::path& get_ProgramFiles_32_bit();
-
- const fs::path& get_ProgramFiles_platform_bitness();
}
diff --git a/toolsrc/include/vcpkg_System.h b/toolsrc/include/vcpkg_System.h
index 84fe43988..33aad646c 100644
--- a/toolsrc/include/vcpkg_System.h
+++ b/toolsrc/include/vcpkg_System.h
@@ -42,7 +42,7 @@ namespace vcpkg::System
}
template <class Arg1, class...Args>
- void print(const color c, const char* messageTemplate, const Arg1& messageArg1, const Args&... messageArgs)
+ void print(const color c, const char* messageTemplate, const Arg1& messageArg1, const Args&... messageArgs)
{
return print(c, Strings::format(messageTemplate, messageArg1, messageArgs...));
}
@@ -62,4 +62,8 @@ namespace vcpkg::System
optional<std::wstring> get_environmental_variable(const cwstring_view varname) noexcept;
optional<std::wstring> get_registry_string(HKEY base, const cwstring_view subkey, const cwstring_view valuename);
+
+ const fs::path& get_ProgramFiles_32_bit();
+
+ const fs::path& get_ProgramFiles_platform_bitness();
}
diff --git a/toolsrc/src/commands_edit.cpp b/toolsrc/src/commands_edit.cpp
index 4faf10bb9..8ed7e58cc 100644
--- a/toolsrc/src/commands_edit.cpp
+++ b/toolsrc/src/commands_edit.cpp
@@ -2,7 +2,6 @@
#include "vcpkg_Commands.h"
#include "vcpkg_System.h"
#include "vcpkg_Input.h"
-#include "vcpkg_Environment.h"
namespace vcpkg::Commands::Edit
{
@@ -30,7 +29,7 @@ namespace vcpkg::Commands::Edit
if (env_EDITOR.empty())
{
- const fs::path CODE_EXE_PATH = Environment::get_ProgramFiles_32_bit() / "Microsoft VS Code/Code.exe";
+ const fs::path CODE_EXE_PATH = System::get_ProgramFiles_32_bit() / "Microsoft VS Code/Code.exe";
if (fs::exists(CODE_EXE_PATH))
{
env_EDITOR = CODE_EXE_PATH;
diff --git a/toolsrc/src/commands_integrate.cpp b/toolsrc/src/commands_integrate.cpp
index 632e8a184..497038d70 100644
--- a/toolsrc/src/commands_integrate.cpp
+++ b/toolsrc/src/commands_integrate.cpp
@@ -8,10 +8,10 @@
namespace vcpkg::Commands::Integrate
{
static const std::array<fs::path, 2> old_system_target_files = {
- Environment::get_ProgramFiles_32_bit() / "MSBuild/14.0/Microsoft.Common.Targets/ImportBefore/vcpkg.nuget.targets",
- Environment::get_ProgramFiles_32_bit() / "MSBuild/14.0/Microsoft.Common.Targets/ImportBefore/vcpkg.system.targets"
+ System::get_ProgramFiles_32_bit() / "MSBuild/14.0/Microsoft.Common.Targets/ImportBefore/vcpkg.nuget.targets",
+ System::get_ProgramFiles_32_bit() / "MSBuild/14.0/Microsoft.Common.Targets/ImportBefore/vcpkg.system.targets"
};
- static const fs::path system_wide_targets_file = Environment::get_ProgramFiles_32_bit() / "MSBuild/Microsoft.Cpp/v4.0/V140/ImportBefore/Default/vcpkg.system.props";
+ static const fs::path system_wide_targets_file = System::get_ProgramFiles_32_bit() / "MSBuild/Microsoft.Cpp/v4.0/V140/ImportBefore/Default/vcpkg.system.props";
static std::string create_appdata_targets_shortcut(const std::string& target_path) noexcept
{
diff --git a/toolsrc/src/vcpkg_Environment.cpp b/toolsrc/src/vcpkg_Environment.cpp
index 01fa6a93c..96482b94b 100644
--- a/toolsrc/src/vcpkg_Environment.cpp
+++ b/toolsrc/src/vcpkg_Environment.cpp
@@ -137,38 +137,4 @@ namespace vcpkg::Environment
static const vcvarsall_and_platform_toolset vcvarsall_bat = find_vcvarsall_bat(paths);
return vcvarsall_bat;
}
-
- static const fs::path& get_ProgramFiles()
- {
- static const fs::path p = System::get_environmental_variable(L"PROGRAMFILES").value_or_exit(VCPKG_LINE_INFO);
- return p;
- }
-
- const fs::path& get_ProgramFiles_32_bit()
- {
- static const fs::path p = []() -> fs::path
- {
- auto value = System::get_environmental_variable(L"ProgramFiles(x86)");
- if (auto v = value.get())
- {
- return std::move(*v);
- }
- return get_ProgramFiles();
- }();
- return p;
- }
-
- const fs::path& get_ProgramFiles_platform_bitness()
- {
- static const fs::path p = []() -> fs::path
- {
- auto value = System::get_environmental_variable(L"ProgramW6432");
- if (auto v = value.get())
- {
- return std::move(*v);
- }
- return get_ProgramFiles();
- }();
- return p;
- }
}
diff --git a/toolsrc/src/vcpkg_System.cpp b/toolsrc/src/vcpkg_System.cpp
index 767017f76..589dd1924 100644
--- a/toolsrc/src/vcpkg_System.cpp
+++ b/toolsrc/src/vcpkg_System.cpp
@@ -202,4 +202,38 @@ namespace vcpkg::System
ret.pop_back(); // remove extra trailing null byte
return ret;
}
+
+ static const fs::path& get_ProgramFiles()
+ {
+ static const fs::path p = System::get_environmental_variable(L"PROGRAMFILES").value_or_exit(VCPKG_LINE_INFO);
+ return p;
+ }
+
+ const fs::path& get_ProgramFiles_32_bit()
+ {
+ static const fs::path p = []() -> fs::path
+ {
+ auto value = System::get_environmental_variable(L"ProgramFiles(x86)");
+ if (auto v = value.get())
+ {
+ return std::move(*v);
+ }
+ return get_ProgramFiles();
+ }();
+ return p;
+ }
+
+ const fs::path& get_ProgramFiles_platform_bitness()
+ {
+ static const fs::path p = []() -> fs::path
+ {
+ auto value = System::get_environmental_variable(L"ProgramW6432");
+ if (auto v = value.get())
+ {
+ return std::move(*v);
+ }
+ return get_ProgramFiles();
+ }();
+ return p;
+ }
}
diff --git a/toolsrc/src/vcpkg_paths.cpp b/toolsrc/src/vcpkg_paths.cpp
index 86106028a..2cbd6602e 100644
--- a/toolsrc/src/vcpkg_paths.cpp
+++ b/toolsrc/src/vcpkg_paths.cpp
@@ -1,5 +1,5 @@
#include "pch.h"
-#include "expected.h"
+#include "vcpkg_expected.h"
#include "vcpkg_paths.h"
#include "metrics.h"
#include "vcpkg_System.h"
@@ -98,8 +98,8 @@ namespace vcpkg
std::vector<fs::path> candidate_paths;
candidate_paths.push_back(downloaded_copy);
candidate_paths.insert(candidate_paths.end(), from_path.cbegin(), from_path.cend());
- candidate_paths.push_back(Environment::get_ProgramFiles_platform_bitness() / "CMake" / "bin" / "cmake.exe");
- candidate_paths.push_back(Environment::get_ProgramFiles_32_bit() / "CMake" / "bin");
+ candidate_paths.push_back(System::get_ProgramFiles_platform_bitness() / "CMake" / "bin" / "cmake.exe");
+ candidate_paths.push_back(System::get_ProgramFiles_32_bit() / "CMake" / "bin");
const optional<fs::path> path = find_if_has_equal_or_greater_version(candidate_paths, version_check_arguments, expected_version);
if (auto p = path.get())
@@ -142,8 +142,8 @@ namespace vcpkg
std::vector<fs::path> candidate_paths;
candidate_paths.push_back(downloaded_copy);
candidate_paths.insert(candidate_paths.end(), from_path.cbegin(), from_path.cend());
- candidate_paths.push_back(Environment::get_ProgramFiles_platform_bitness() / "git" / "cmd" / "git.exe");
- candidate_paths.push_back(Environment::get_ProgramFiles_32_bit() / "git" / "cmd" / "git.exe");
+ candidate_paths.push_back(System::get_ProgramFiles_platform_bitness() / "git" / "cmd" / "git.exe");
+ candidate_paths.push_back(System::get_ProgramFiles_32_bit() / "git" / "cmd" / "git.exe");
const optional<fs::path> path = find_if_has_equal_or_greater_version(candidate_paths, version_check_arguments, expected_version);
if (auto p = path.get())