fix: print parent folder of mod variants (#52)

* Print parent folder of mod variants

Because some mods have multiple variants with the same name.
As is, it is impossible to tell them apart in the selection.
This commit changes the selection to also print the parent folder of the
variants.

* remove the name of the mod zip/dir itself because it not necessary

---------

Co-authored-by: v4n <105587619+v4n00@users.noreply.github.com>
This commit is contained in:
F. St.
2025-04-19 13:57:20 +02:00
committed by GitHub
parent ebadc049e7
commit 35302aa7c7
+14 -1
View File
@@ -863,8 +863,21 @@ function mod_install() {
if [[ ${#filtered_dirs[@]} -gt 1 ]]; then if [[ ${#filtered_dirs[@]} -gt 1 ]]; then
log INFO "Multiple mod variants found for mod ${mod_name}." log INFO "Multiple mod variants found for mod ${mod_name}."
# print the variant name by display all the directories (and how they're nested)
# first, take the basename of the directory/zip we're installing from
# then, make the variant name by removing the tmp dir name from the path (if it's a zip)
# finally, take out this name, if it exists
if [[ -n "$mod_zip" ]]; then
mod_file_name="$(get_basename "$mod_zip")"
else
mod_file_name="*"
fi
for i in "${!filtered_dirs[@]}"; do for i in "${!filtered_dirs[@]}"; do
log INFO "$((i + 1)). $(basename "${filtered_dirs[$i]}")" variant_name="${filtered_dirs[$i]#$mod_dir/}" # remote temp name in case its a zip
log INFO "$((i + 1)). ${variant_name#$mod_file_name/}" # remote the name of the zip/dir if it exists
done done
# prompt user to choose # prompt user to choose