From 877689ab5ed02e0ce20ec08b53ff77017d6464cf Mon Sep 17 00:00:00 2001 From: Sergey Palcheh Date: Thu, 10 Jul 2025 13:58:26 +0600 Subject: [PATCH] choosing to cancel the prefix by 0 --- winehelper | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/winehelper b/winehelper index 7d6b0b5..4ab4396 100755 --- a/winehelper +++ b/winehelper @@ -903,17 +903,25 @@ check_prefix_var () { for prefix in "$WH_PREFIXES_DIR"/* ; do if [[ -d "$prefix" ]]; then prefixes+=("$prefix") - echo "$count. $(basename "$prefix")" ((count++)) fi done [[ ${#prefixes[@]} -eq 0 ]] && fatal "Не найдено ни одного префикса!" - local max_choice=${#prefixes[@]} - read -p "Выберите префикс (1-$max_choice): " choice + echo "0 - Отмена" - if [[ "$choice" -ge 1 && "$choice" -le "$max_choice" ]] ; then + for ((i=0; i<${#prefixes[@]}; i++)); do + echo "$((i+1)) - $(basename "${prefixes[$i]}")" + done + + local max_choice=${#prefixes[@]} + read -p "Выберите префикс (0-$max_choice): " choice + + if [[ "$choice" == "0" ]]; then + print_info "Выбор префикса отменен." + exit 0 + elif [[ "$choice" -ge 1 && "$choice" -le "$max_choice" ]] ; then export WINEPREFIX="${prefixes[$choice-1]}" else fatal "Неверный выбор."