From bc1c7f4e4f842babb22b1630247c8dd418794dd0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Stig-=C3=98rjan=20Smelror?= Date: Mon, 4 Mar 2024 20:34:23 +0100 Subject: [PATCH] Fix directory removal logic in zrep_remove_package function - Corrected the logic to check if the first letter directory is empty before deletion - Updated the README with work-in-progress status and a call for help and feedback - Mon, 04 Mar 2024 20:34:23 +0100 --- README.md | 9 ++++++++- zrep | 2 +- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 91e506f..f067e7c 100644 --- a/README.md +++ b/README.md @@ -1,3 +1,10 @@ # zrep -The Zsh Repository tool, akin to PyPi and pip \ No newline at end of file +The Zsh Repository tool, akin to PyPi and pip + +
+ +This is a work in progress. Some functionality is in place, but the back-end is still missing a lot. + +Would love help and feedback! + diff --git a/zrep b/zrep index 4a4873d..ec526bb 100755 --- a/zrep +++ b/zrep @@ -313,7 +313,7 @@ function zrep_remove_package() { echo "Author directory '$author_dir' removed successfully." # Check if the first letter directory is empty and delete it if so - if [[ $(($#first_letter/*)) -eq 0 ]]; then + if [[ -d "${config[main_zrep_install_dir]}/$first_letter" && ! *(D) "${config[main_zrep_install_dir]}/$first_letter" ]]; then rm -rf "${config[main_zrep_install_dir]}/$first_letter" echo "First letter directory '${config[main_zrep_install_dir]}/$first_letter' removed successfully." fi