From c11b2c790e0260434d057cd5fbeccd59f36732c7 Mon Sep 17 00:00:00 2001 From: Alexander Karatarakis Date: Tue, 14 Feb 2017 13:21:30 -0800 Subject: Rename wdupenv_str to get_environmental_variable() --- toolsrc/src/commands_edit.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'toolsrc/src/commands_edit.cpp') diff --git a/toolsrc/src/commands_edit.cpp b/toolsrc/src/commands_edit.cpp index dff30f7ad..a25a9e4dc 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)"; -- cgit v1.2.3 From b882f365e9aebf95c07c8667e38ae2730931f74e Mon Sep 17 00:00:00 2001 From: Alexander Karatarakis Date: Tue, 14 Feb 2017 15:35:34 -0800 Subject: System::get_environmental_variable() now returns optional<> --- toolsrc/src/commands_edit.cpp | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) (limited to 'toolsrc/src/commands_edit.cpp') diff --git a/toolsrc/src/commands_edit.cpp b/toolsrc/src/commands_edit.cpp index a25a9e4dc..1487c759d 100644 --- a/toolsrc/src/commands_edit.cpp +++ b/toolsrc/src/commands_edit.cpp @@ -15,8 +15,14 @@ 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::get_environmental_variable(L"EDITOR"); - if (env_EDITOR.empty()) + const optional env_EDITOR_optional = System::get_environmental_variable(L"EDITOR"); + std::wstring env_EDITOR; + + if (env_EDITOR_optional) + { + env_EDITOR = *env_EDITOR_optional; + } + else { static const std::wstring CODE_EXE_PATH = LR"(C:\Program Files (x86)\Microsoft VS Code\Code.exe)"; if (fs::exists(CODE_EXE_PATH)) -- cgit v1.2.3 From a7c5063d4d08c44c100eb62726ef31a95c1e5121 Mon Sep 17 00:00:00 2001 From: Alexander Karatarakis Date: Tue, 14 Feb 2017 16:23:02 -0800 Subject: Add functions to find the Program Files folders on the C++ side. Resolves #606 --- toolsrc/src/commands_edit.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'toolsrc/src/commands_edit.cpp') diff --git a/toolsrc/src/commands_edit.cpp b/toolsrc/src/commands_edit.cpp index 1487c759d..50308cec9 100644 --- a/toolsrc/src/commands_edit.cpp +++ b/toolsrc/src/commands_edit.cpp @@ -2,6 +2,7 @@ #include "vcpkg_Commands.h" #include "vcpkg_System.h" #include "vcpkg_Input.h" +#include "vcpkg_Environment.h" namespace vcpkg::Commands::Edit { @@ -24,7 +25,7 @@ namespace vcpkg::Commands::Edit } else { - static const std::wstring CODE_EXE_PATH = LR"(C:\Program Files (x86)\Microsoft VS Code\Code.exe)"; + static const fs::path CODE_EXE_PATH = Environment::get_ProgramFiles_32_bit() / "Microsoft VS Code/Code.exe"; if (fs::exists(CODE_EXE_PATH)) { env_EDITOR = CODE_EXE_PATH; -- cgit v1.2.3 From 21729d3d43a1369014b60e2af368a3e48ae5c82f Mon Sep 17 00:00:00 2001 From: Alexander Karatarakis Date: Fri, 17 Feb 2017 15:33:14 -0800 Subject: `create`/`edit`: check for --options --- toolsrc/src/commands_edit.cpp | 1 + 1 file changed, 1 insertion(+) (limited to 'toolsrc/src/commands_edit.cpp') diff --git a/toolsrc/src/commands_edit.cpp b/toolsrc/src/commands_edit.cpp index 50308cec9..5a2433e5a 100644 --- a/toolsrc/src/commands_edit.cpp +++ b/toolsrc/src/commands_edit.cpp @@ -10,6 +10,7 @@ namespace vcpkg::Commands::Edit { static const std::string example = Commands::Help::create_example_string("edit zlib"); args.check_exact_arg_count(1, example); + args.check_and_get_optional_command_arguments({}); const std::string port_name = args.command_arguments.at(0); const fs::path portpath = paths.ports / port_name; -- cgit v1.2.3