From 35302aa7c709bf658e446321ecf04b86b363f5cf Mon Sep 17 00:00:00 2001 From: "F. St." <39712181+Feriixu@users.noreply.github.com> Date: Sat, 19 Apr 2025 13:57:20 +0200 Subject: [PATCH] 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> --- h2mm | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/h2mm b/h2mm index a7ffb57..aa41288 100755 --- a/h2mm +++ b/h2mm @@ -863,8 +863,21 @@ function mod_install() { if [[ ${#filtered_dirs[@]} -gt 1 ]]; then 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 - 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 # prompt user to choose