aboutsummaryrefslogtreecommitdiff
path: root/toolsrc/src/commands_edit.cpp
diff options
context:
space:
mode:
authorRobert Schumacher <roschuma@microsoft.com>2017-02-21 13:39:36 -0800
committerGitHub <noreply@github.com>2017-02-21 13:39:36 -0800
commit7d4df89c1dfff0b2bad0165ac4579f6352935a94 (patch)
tree8b87d29fb74fb24984d5aff9b021f14d95afb5ab /toolsrc/src/commands_edit.cpp
parentd9462fdf490d3396cac58b1a935b1b8a982b3a72 (diff)
parentb921dce5fc17bd4c1c206b79eb0a7b8758dcf5bf (diff)
downloadvcpkg-7d4df89c1dfff0b2bad0165ac4579f6352935a94.tar.gz
vcpkg-7d4df89c1dfff0b2bad0165ac4579f6352935a94.zip
Merge branch 'master' into master
Diffstat (limited to 'toolsrc/src/commands_edit.cpp')
-rw-r--r--toolsrc/src/commands_edit.cpp14
1 files changed, 11 insertions, 3 deletions
diff --git a/toolsrc/src/commands_edit.cpp b/toolsrc/src/commands_edit.cpp
index dff30f7ad..5a2433e5a 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
{
@@ -9,16 +10,23 @@ 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;
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");
- if (env_EDITOR.empty())
+ const optional<std::wstring> 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)";
+ 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;