mirror of
https://github.com/microsoft/vcpkg.git
synced 2025-01-15 10:32:42 +08:00
[vcpkg-edit] Open package folders when passed --all
This commit is contained in:
parent
725cbbd47e
commit
90ebb375f6
@ -64,14 +64,29 @@ namespace vcpkg::Commands::Edit
|
|||||||
{
|
{
|
||||||
if (Util::Sets::contains(options.switches, OPTION_ALL))
|
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 {
|
return Util::fmap(ports, [&](const std::string& port_name) -> std::string {
|
||||||
const auto portpath = paths.ports / port_name;
|
const auto portpath = paths.ports / port_name;
|
||||||
const auto portfile = portpath / "portfile.cmake";
|
const auto portfile = portpath / "portfile.cmake";
|
||||||
const auto buildtrees_current_dir = paths.buildtrees / port_name;
|
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(),
|
portpath.u8string(),
|
||||||
portfile.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)
|
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_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 = fs::path{"Microsoft VS Code"} / "Code.exe";
|
||||||
|
|
||||||
auto& fs = paths.get_filesystem();
|
auto& fs = paths.get_filesystem();
|
||||||
|
|
||||||
@ -131,7 +146,7 @@ namespace vcpkg::Commands::Edit
|
|||||||
const auto& app_data = System::get_environment_variable("APPDATA");
|
const auto& app_data = System::get_environment_variable("APPDATA");
|
||||||
if (const auto* ad = app_data.get())
|
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_INSIDERS);
|
||||||
candidate_paths.push_back(default_base / VS_CODE);
|
candidate_paths.push_back(default_base / VS_CODE);
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user