diff options
| author | Alexander Karatarakis <alkarata@microsoft.com> | 2017-03-28 15:05:55 -0700 |
|---|---|---|
| committer | Alexander Karatarakis <alkarata@microsoft.com> | 2017-03-28 18:59:57 -0700 |
| commit | 42bd55e3ae815e43181facfdc161d29804014f26 (patch) | |
| tree | d0e4db89947aa557ec6e3bf6065cfb43cbc796ff /toolsrc/src/commands_edit.cpp | |
| parent | 67ce764c2ea7483860a3ad61441608d8978605ae (diff) | |
| download | vcpkg-42bd55e3ae815e43181facfdc161d29804014f26.tar.gz vcpkg-42bd55e3ae815e43181facfdc161d29804014f26.zip | |
Rework optional<T>
Diffstat (limited to 'toolsrc/src/commands_edit.cpp')
| -rw-r--r-- | toolsrc/src/commands_edit.cpp | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/toolsrc/src/commands_edit.cpp b/toolsrc/src/commands_edit.cpp index d9cd627d2..4faf10bb9 100644 --- a/toolsrc/src/commands_edit.cpp +++ b/toolsrc/src/commands_edit.cpp @@ -22,9 +22,9 @@ namespace vcpkg::Commands::Edit if (env_EDITOR.empty()) { const optional<std::wstring> env_EDITOR_optional = System::get_environmental_variable(L"EDITOR"); - if (env_EDITOR_optional) + if (auto e = env_EDITOR_optional.get()) { - env_EDITOR = *env_EDITOR_optional; + env_EDITOR = *e; } } @@ -47,16 +47,16 @@ namespace vcpkg::Commands::Edit }; for (auto&& keypath : regkeys) { - auto code_installpath = System::get_registry_string(HKEY_LOCAL_MACHINE, keypath, L"InstallLocation"); - if (code_installpath) + const optional<std::wstring> code_installpath = System::get_registry_string(HKEY_LOCAL_MACHINE, keypath, L"InstallLocation"); + if (auto c = code_installpath.get()) { - auto p = fs::path(*code_installpath) / "Code.exe"; + auto p = fs::path(*c) / "Code.exe"; if (fs::exists(p)) { env_EDITOR = p.native(); break; } - auto p_insiders = fs::path(*code_installpath) / "Code - Insiders.exe"; + auto p_insiders = fs::path(*c) / "Code - Insiders.exe"; if (fs::exists(p_insiders)) { env_EDITOR = p_insiders.native(); |
