added vscode autodetection in macOS (#4589)

This commit is contained in:
Agustín Rodríguez 2018-11-06 22:48:34 -03:00 committed by Robert Schumacher
parent eaf30a4221
commit f194e98593

View File

@ -107,9 +107,6 @@ namespace vcpkg::Commands::Edit
void perform_and_exit(const VcpkgCmdArguments& args, const VcpkgPaths& paths) void perform_and_exit(const VcpkgCmdArguments& args, const VcpkgPaths& paths)
{ {
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"} / "Code.exe";
auto& fs = paths.get_filesystem(); auto& fs = paths.get_filesystem();
const ParsedArguments options = args.parse_arguments(COMMAND_STRUCTURE); const ParsedArguments options = args.parse_arguments(COMMAND_STRUCTURE);
@ -129,6 +126,10 @@ namespace vcpkg::Commands::Edit
candidate_paths.emplace_back(*editor_path); candidate_paths.emplace_back(*editor_path);
} }
#ifdef _WIN32
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"} / "Code.exe";
const auto& program_files = System::get_program_files_platform_bitness(); const auto& program_files = System::get_program_files_platform_bitness();
if (const fs::path* pf = program_files.get()) if (const fs::path* pf = program_files.get())
{ {
@ -153,6 +154,10 @@ namespace vcpkg::Commands::Edit
const std::vector<fs::path> from_registry = find_from_registry(); const std::vector<fs::path> from_registry = find_from_registry();
candidate_paths.insert(candidate_paths.end(), from_registry.cbegin(), from_registry.cend()); candidate_paths.insert(candidate_paths.end(), from_registry.cbegin(), from_registry.cend());
#elif defined(__APPLE__)
candidate_paths.push_back(fs::path{"/Applications/Visual Studio Code - Insiders.app/Contents/Resources/app/bin/code"});
candidate_paths.push_back(fs::path{"/Applications/Visual Studio Code.app/Contents/Resources/app/bin/code"});
#endif
const auto it = Util::find_if(candidate_paths, [&](const fs::path& p) { return fs.exists(p); }); const auto it = Util::find_if(candidate_paths, [&](const fs::path& p) { return fs.exists(p); });
if (it == candidate_paths.cend()) if (it == candidate_paths.cend())