From 6363910319a082512179269fb6329ecbc367b3bc Mon Sep 17 00:00:00 2001 From: Alexander Karatarakis Date: Thu, 14 Sep 2017 15:45:32 -0700 Subject: [PATCH] `vcpkg edit`: Improve detection for VSCode - Insiders. Prefer it if available --- toolsrc/src/commands_edit.cpp | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/toolsrc/src/commands_edit.cpp b/toolsrc/src/commands_edit.cpp index dc28de7377..7f400f48b9 100644 --- a/toolsrc/src/commands_edit.cpp +++ b/toolsrc/src/commands_edit.cpp @@ -8,11 +8,10 @@ namespace vcpkg::Commands::Edit { static std::vector find_from_registry() { - static const std::array REGKEYS = { + static const std::array REGKEYS = { LR"(SOFTWARE\WOW6432Node\Microsoft\Windows\CurrentVersion\Uninstall\{C26E74D1-022E-4238-8B9D-1E7564A36CC9}_is1)", - LR"(SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\{C26E74D1-022E-4238-8B9D-1E7564A36CC9}_is1)", + LR"(SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\{1287CAD5-7C8D-410D-88B9-0D1EE4A83FF2}_is1)", LR"(SOFTWARE\WOW6432Node\Microsoft\Windows\CurrentVersion\Uninstall\{F8A2A208-72B3-4D61-95FC-8A65D340689B}_is1)", - LR"(SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\{F8A2A208-72B3-4D61-95FC-8A65D340689B}_is1)", }; std::vector output; @@ -23,8 +22,8 @@ namespace vcpkg::Commands::Edit if (const auto c = code_installpath.get()) { const fs::path install_path = fs::path(*c); - output.push_back(install_path / "Code.exe"); output.push_back(install_path / "Code - Insiders.exe"); + output.push_back(install_path / "Code.exe"); } } return output; @@ -34,6 +33,9 @@ namespace vcpkg::Commands::Edit { static const std::string OPTION_BUILDTREES = "--buildtrees"; + static const fs::path VS_CODE_INSIDERS = fs::path{"Microsoft VS Code Insiders"} / "Code - Insiders.exe"; + static const fs::path VS_CODE = fs::path{"Microsoft VS Code Insiders"} / "Code - Insiders.exe"; + auto& fs = paths.get_filesystem(); static const std::string EXAMPLE = Commands::Help::create_example_string("edit zlib"); @@ -48,8 +50,10 @@ namespace vcpkg::Commands::Edit std::vector candidate_paths; const std::vector from_path = Files::find_from_PATH(L"EDITOR"); candidate_paths.insert(candidate_paths.end(), from_path.cbegin(), from_path.cend()); - candidate_paths.push_back(System::get_program_files_platform_bitness() / "Microsoft VS Code" / "Code.exe"); - candidate_paths.push_back(System::get_program_files_32_bit() / "Microsoft VS Code" / "Code.exe"); + candidate_paths.push_back(System::get_program_files_platform_bitness() / VS_CODE_INSIDERS); + candidate_paths.push_back(System::get_program_files_32_bit() / VS_CODE_INSIDERS); + candidate_paths.push_back(System::get_program_files_platform_bitness() / VS_CODE); + candidate_paths.push_back(System::get_program_files_32_bit() / VS_CODE); const std::vector from_registry = find_from_registry(); candidate_paths.insert(candidate_paths.end(), from_registry.cbegin(), from_registry.cend());