aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRobert Schumacher <roschuma@microsoft.com>2018-10-19 00:42:37 -0700
committerRobert Schumacher <roschuma@microsoft.com>2018-10-19 09:07:24 -0700
commit90ebb375f67723b54be21a604892c4750f774969 (patch)
tree0cddcf34690dc32846a2d2125d6d5d3117625ea0
parent725cbbd47ed7a611d815ba41672f07f2f3e270ec (diff)
downloadvcpkg-90ebb375f67723b54be21a604892c4750f774969.tar.gz
vcpkg-90ebb375f67723b54be21a604892c4750f774969.zip
[vcpkg-edit] Open package folders when passed --all
-rw-r--r--toolsrc/src/vcpkg/commands.edit.cpp25
1 files changed, 20 insertions, 5 deletions
diff --git a/toolsrc/src/vcpkg/commands.edit.cpp b/toolsrc/src/vcpkg/commands.edit.cpp
index 237feebdd..b9d9d8c1a 100644
--- a/toolsrc/src/vcpkg/commands.edit.cpp
+++ b/toolsrc/src/vcpkg/commands.edit.cpp
@@ -64,14 +64,29 @@ namespace vcpkg::Commands::Edit
{
if (Util::Sets::contains(options.switches, OPTION_ALL))
{
+ const auto& fs = paths.get_filesystem();
+ auto packages = fs.get_files_non_recursive(paths.packages);
+
return Util::fmap(ports, [&](const std::string& port_name) -> std::string {
const auto portpath = paths.ports / port_name;
const auto portfile = portpath / "portfile.cmake";
const auto buildtrees_current_dir = paths.buildtrees / port_name;
- return Strings::format(R"###("%s" "%s" "%s")###",
+ const auto pattern = port_name + "_";
+
+ std::string package_paths;
+ for (auto&& package : packages)
+ {
+ if (Strings::case_insensitive_ascii_starts_with(package.filename().u8string(), pattern))
+ {
+ package_paths.append(Strings::format(" \"%s\"", package.u8string()));
+ }
+ }
+
+ return Strings::format(R"###("%s" "%s" "%s"%s)###",
portpath.u8string(),
portfile.u8string(),
- buildtrees_current_dir.u8string());
+ buildtrees_current_dir.u8string(),
+ package_paths);
});
}
@@ -92,8 +107,8 @@ namespace vcpkg::Commands::Edit
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";
+ 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();
@@ -131,7 +146,7 @@ namespace vcpkg::Commands::Edit
const auto& app_data = System::get_environment_variable("APPDATA");
if (const auto* ad = app_data.get())
{
- const fs::path default_base = fs::path {*ad}.parent_path() / "Local" / "Programs";
+ const fs::path default_base = fs::path{*ad}.parent_path() / "Local" / "Programs";
candidate_paths.push_back(default_base / VS_CODE_INSIDERS);
candidate_paths.push_back(default_base / VS_CODE);
}