Skip to content

Commit

Permalink
fix: recipes not in rppi installed by -g can't be delete and purge
Browse files Browse the repository at this point in the history
  • Loading branch information
fxliang committed Jan 4, 2024
1 parent 6a73d96 commit 4f8a718
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions src/rppi_get.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -998,6 +998,8 @@ int main(int argc, char **argv) {
recipe_file = repo.substr(pos + 1) + ".recipe.yaml";
repo = repo.substr(0, pos);
}
pos = repo.find('/');
std::string local_path = repo.substr(pos + 1);
std::vector<Recipe> res =
filter_recipes_with_keyword(recipes, repo, true);
if (res.size()) {
Expand All @@ -1006,6 +1008,12 @@ int main(int argc, char **argv) {
std::cout << ", with recipe file: " << recipe_file;
std::cout << std::endl;
delete_recipe(res.at(0), recipe_file);
} else if (load_json(cache_dir + sep + ".installed_recipes.json")
.contains(local_path)) {
Recipe recipe;
recipe.repo = repo;
recipe.local_path = local_path;
delete_recipe(recipe, recipe_file);
} else {
std::cout << "delete recipe by : " << result["delete"].as<std::string>()
<< " failed ||-_-" << std::endl;
Expand All @@ -1017,10 +1025,18 @@ int main(int argc, char **argv) {
repo = convertToUtf8(repo);
std::vector<Recipe> res =
filter_recipes_with_keyword(recipes, repo, true);
size_t pos = repo.find('/');
std::string local_path = repo.substr(pos + 1);
if (res.size()) {
std::cout << "purge recipe by keyword : " << repo;
std::cout << std::endl;
delete_recipe(res.at(0), "", true);
} else if (load_json(cache_dir + sep + ".installed_recipes.json")
.contains(local_path)) {
Recipe recipe;
recipe.repo = repo;
recipe.local_path = local_path;
delete_recipe(recipe, "", true);
} else {
std::cout << "purge recipe by : " << result["purge"].as<std::string>()
<< " failed ||-_-" << std::endl;
Expand Down

0 comments on commit 4f8a718

Please sign in to comment.