fix: uninstall correctly reindexes (fix #21)

This commit is contained in:
v4n
2025-03-07 22:57:14 +02:00
parent df006a7430
commit 797739ea7a
+7
View File
@@ -837,6 +837,13 @@ function mod_uninstall() {
# remove entry from database # remove entry from database
sed -i "/^$mod_index,/d" "$DB_FILE" sed -i "/^$mod_index,/d" "$DB_FILE"
# reindex the database
mods_to_reindex=($(awk -F, -v idx=$mod_index 'NR > 1 && $1 > idx {print $1}' "$DB_FILE"))
for idx in "${mods_to_reindex[@]}"; do
sed -i "s/^$idx,/$(($idx - 1)),/" "$DB_FILE"
done
log INFO "Mod $mod_name ${ORANGE}uninstalled${NC} successfully." log INFO "Mod $mod_name ${ORANGE}uninstalled${NC} successfully."
# disable any modpack # disable any modpack