diff options
| author | Alexander Karatarakis <alkarata@microsoft.com> | 2017-02-14 15:35:34 -0800 |
|---|---|---|
| committer | Alexander Karatarakis <alkarata@microsoft.com> | 2017-02-14 15:35:34 -0800 |
| commit | b882f365e9aebf95c07c8667e38ae2730931f74e (patch) | |
| tree | 16f9b6e78024aa277cfb7470a5ad3f6eae002d9b /toolsrc/src/commands_edit.cpp | |
| parent | a5181331653592afcd6223140722ecbcfa58c94d (diff) | |
| download | vcpkg-b882f365e9aebf95c07c8667e38ae2730931f74e.tar.gz vcpkg-b882f365e9aebf95c07c8667e38ae2730931f74e.zip | |
System::get_environmental_variable() now returns optional<>
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)) |
