From c11b2c790e0260434d057cd5fbeccd59f36732c7 Mon Sep 17 00:00:00 2001 From: Alexander Karatarakis Date: Tue, 14 Feb 2017 13:21:30 -0800 Subject: [PATCH] Rename wdupenv_str to get_environmental_variable() --- toolsrc/include/vcpkg_System.h | 2 +- toolsrc/src/commands_edit.cpp | 2 +- toolsrc/src/commands_integrate.cpp | 2 +- toolsrc/src/vcpkg.cpp | 4 ++-- toolsrc/src/vcpkg_Environment.cpp | 8 ++++---- toolsrc/src/vcpkg_System.cpp | 2 +- 6 files changed, 10 insertions(+), 10 deletions(-) diff --git a/toolsrc/include/vcpkg_System.h b/toolsrc/include/vcpkg_System.h index c9195163c5..92ceacc88b 100644 --- a/toolsrc/include/vcpkg_System.h +++ b/toolsrc/include/vcpkg_System.h @@ -92,5 +92,5 @@ namespace vcpkg::System double microseconds() const; }; - std::wstring wdupenv_str(const wchar_t* varname) noexcept; + std::wstring get_environmental_variable(const wchar_t* varname) noexcept; } diff --git a/toolsrc/src/commands_edit.cpp b/toolsrc/src/commands_edit.cpp index dff30f7add..a25a9e4dc6 100644 --- a/toolsrc/src/commands_edit.cpp +++ b/toolsrc/src/commands_edit.cpp @@ -15,7 +15,7 @@ namespace vcpkg::Commands::Edit Checks::check_exit(fs::is_directory(portpath), R"(Could not find port named "%s")", port_name); // Find editor - std::wstring env_EDITOR = System::wdupenv_str(L"EDITOR"); + std::wstring env_EDITOR = System::get_environmental_variable(L"EDITOR"); if (env_EDITOR.empty()) { static const std::wstring CODE_EXE_PATH = LR"(C:\Program Files (x86)\Microsoft VS Code\Code.exe)"; diff --git a/toolsrc/src/commands_integrate.cpp b/toolsrc/src/commands_integrate.cpp index 03c51b5a75..93fb294870 100644 --- a/toolsrc/src/commands_integrate.cpp +++ b/toolsrc/src/commands_integrate.cpp @@ -136,7 +136,7 @@ namespace vcpkg::Commands::Integrate static fs::path get_appdata_targets_path() { - return fs::path(System::wdupenv_str(L"LOCALAPPDATA")) / "vcpkg" / "vcpkg.user.targets"; + return fs::path(System::get_environmental_variable(L"LOCALAPPDATA")) / "vcpkg" / "vcpkg.user.targets"; } static void integrate_install(const vcpkg_paths& paths) diff --git a/toolsrc/src/vcpkg.cpp b/toolsrc/src/vcpkg.cpp index 3e313c7022..27a34b80d4 100644 --- a/toolsrc/src/vcpkg.cpp +++ b/toolsrc/src/vcpkg.cpp @@ -47,7 +47,7 @@ static void inner(const vcpkg_cmd_arguments& args) } else { - auto vcpkg_root_dir_env = System::wdupenv_str(L"VCPKG_ROOT"); + auto vcpkg_root_dir_env = System::get_environmental_variable(L"VCPKG_ROOT"); if (!vcpkg_root_dir_env.empty()) { @@ -79,7 +79,7 @@ static void inner(const vcpkg_cmd_arguments& args) } else { - const auto vcpkg_default_triplet_env = System::wdupenv_str(L"VCPKG_DEFAULT_TRIPLET"); + const auto vcpkg_default_triplet_env = System::get_environmental_variable(L"VCPKG_DEFAULT_TRIPLET"); if (!vcpkg_default_triplet_env.empty()) { default_target_triplet = triplet::from_canonical_name(Strings::utf16_to_utf8(vcpkg_default_triplet_env)); diff --git a/toolsrc/src/vcpkg_Environment.cpp b/toolsrc/src/vcpkg_Environment.cpp index 1babdc5470..abde735cb5 100644 --- a/toolsrc/src/vcpkg_Environment.cpp +++ b/toolsrc/src/vcpkg_Environment.cpp @@ -57,7 +57,7 @@ namespace vcpkg::Environment const fs::path downloaded_git = paths.downloads / "PortableGit" / "cmd"; const std::wstring path_buf = Strings::wformat(L"%s;%s;%s;%s", downloaded_git.native(), - System::wdupenv_str(L"PATH"), + System::get_environmental_variable(L"PATH"), default_git_installation_dir.native(), default_git_installation_dir_x86.native()); _wputenv_s(L"PATH", path_buf.c_str()); @@ -73,7 +73,7 @@ namespace vcpkg::Environment const fs::path downloaded_cmake = paths.downloads / "cmake-3.7.2-win32-x86" / "bin"; const std::wstring path_buf = Strings::wformat(L"%s;%s;%s;%s", downloaded_cmake.native(), - System::wdupenv_str(L"PATH"), + System::get_environmental_variable(L"PATH"), default_cmake_installation_dir.native(), default_cmake_installation_dir_x86.native()); _wputenv_s(L"PATH", path_buf.c_str()); @@ -87,7 +87,7 @@ namespace vcpkg::Environment void ensure_nuget_on_path(const vcpkg_paths& paths) { const fs::path downloaded_nuget = paths.downloads / "nuget-3.5.0"; - const std::wstring path_buf = Strings::wformat(L"%s;%s", downloaded_nuget.native(), System::wdupenv_str(L"PATH")); + const std::wstring path_buf = Strings::wformat(L"%s;%s", downloaded_nuget.native(), System::get_environmental_variable(L"PATH")); _wputenv_s(L"PATH", path_buf.c_str()); static constexpr std::array nuget_version = {3,3,0}; @@ -107,7 +107,7 @@ namespace vcpkg::Environment static const fs::path& get_VS2015_installation_instance() { - static const fs::path vs2015_cmntools = fs::path(System::wdupenv_str(L"VS140COMNTOOLS")).parent_path(); // The call to parent_path() is needed because the env variable has a trailing backslash + static const fs::path vs2015_cmntools = fs::path(System::get_environmental_variable(L"VS140COMNTOOLS")).parent_path(); // The call to parent_path() is needed because the env variable has a trailing backslash static const fs::path vs2015_path = vs2015_cmntools.parent_path().parent_path(); return vs2015_path; } diff --git a/toolsrc/src/vcpkg_System.cpp b/toolsrc/src/vcpkg_System.cpp index 754a26741f..1d9f8e6966 100644 --- a/toolsrc/src/vcpkg_System.cpp +++ b/toolsrc/src/vcpkg_System.cpp @@ -73,7 +73,7 @@ namespace vcpkg::System std::cout << "\n"; } - std::wstring wdupenv_str(const wchar_t* varname) noexcept + std::wstring get_environmental_variable(const wchar_t* varname) noexcept { std::wstring ret; wchar_t* buffer;