diff options
Diffstat (limited to 'toolsrc/src/commands_edit.cpp')
| -rw-r--r-- | toolsrc/src/commands_edit.cpp | 10 |
1 files changed, 8 insertions, 2 deletions
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<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)"; if (fs::exists(CODE_EXE_PATH)) |
