mirror of
https://github.com/microsoft/vcpkg.git
synced 2024-11-25 20:29:00 +08:00
Rename wdupenv_str to get_environmental_variable()
This commit is contained in:
parent
8aa82bb895
commit
c11b2c790e
@ -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;
|
||||
}
|
||||
|
@ -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)";
|
||||
|
@ -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)
|
||||
|
@ -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));
|
||||
|
@ -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<int, 3> 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;
|
||||
}
|
||||
|
@ -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;
|
||||
|
Loading…
Reference in New Issue
Block a user