From 63beb68e34d0b2b2b592f26a23bd7191412717a3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Utku=20Enes=20G=C3=9CRSEL?= Date: Sun, 18 Feb 2024 13:06:03 +0300 Subject: [PATCH] delete index db when deleting repository (#70) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * delete index db when deleting repository * better warning message Co-authored-by: Onur Özkan --------- Co-authored-by: Onur Özkan --- lpm/core/src/repository.rs | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/lpm/core/src/repository.rs b/lpm/core/src/repository.rs index 1d316df..4197d97 100644 --- a/lpm/core/src/repository.rs +++ b/lpm/core/src/repository.rs @@ -96,6 +96,15 @@ pub fn delete_repositories( info!("Deleting list of repositories: {:?}", repository_names); db::delete_repositories(&ctx.core_db, repository_names.to_vec())?; + repository_names.iter().for_each(|repository| { + if let Err(err) = fs::remove_file(Path::new(REPOSITORY_INDEX_DB_DIR).join(repository)) { + warning!( + "Couldn't clean the index database of {}. Reason: {}", + repository, + err + ) + } + }); Ok(()) }