choosing to cancel the prefix by 0

This commit is contained in:
Sergey Palcheh
2025-07-10 13:58:26 +06:00
parent 418493b7b8
commit 877689ab5e

View File

@ -903,17 +903,25 @@ check_prefix_var () {
for prefix in "$WH_PREFIXES_DIR"/* ; do for prefix in "$WH_PREFIXES_DIR"/* ; do
if [[ -d "$prefix" ]]; then if [[ -d "$prefix" ]]; then
prefixes+=("$prefix") prefixes+=("$prefix")
echo "$count. $(basename "$prefix")"
((count++)) ((count++))
fi fi
done done
[[ ${#prefixes[@]} -eq 0 ]] && fatal "Не найдено ни одного префикса!" [[ ${#prefixes[@]} -eq 0 ]] && fatal "Не найдено ни одного префикса!"
local max_choice=${#prefixes[@]} echo "0 - Отмена"
read -p "Выберите префикс (1-$max_choice): " choice
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]}" export WINEPREFIX="${prefixes[$choice-1]}"
else else
fatal "Неверный выбор." fatal "Неверный выбор."