Compare commits

3 Commits

Author SHA1 Message Date
Mikhail Tergoev
d553256a7a dropped warn about prefix is not selected 2025-07-10 14:13:03 +03:00
Mikhail Tergoev
33dd0aa45e Merge branch 'minergenon-cancel_prefix' 2025-07-10 13:47:50 +03:00
Sergey Palcheh
877689ab5e choosing to cancel the prefix by 0 2025-07-10 13:58:26 +06:00

View File

@@ -895,25 +895,33 @@ get_base_pfx () {
check_prefix_var () {
if [[ -z "$WINEPREFIX" ]] ; then
print_warning "Префикс не выбран."
local prefixes=()
local count=1
print_info "Доступные префиксы WineHelper:"
for prefix in "$WH_PREFIXES_DIR"/* ; do
if [[ -d "$prefix" ]]; then
prefixes+=("$prefix")
echo "$count. $(basename "$prefix")"
((count++))
fi
done
[[ ${#prefixes[@]} -eq 0 ]] && fatal "Не найдено ни одного префикса!"
if [[ ${#prefixes[@]} -eq 0 ]]
then fatal "Не найдено ни одного префикса!"
else print_info "Доступные префиксы WineHelper:"
fi
echo "0 - Отмена"
for ((i=0; i<${#prefixes[@]}; i++)); do
echo "$((i+1)) - $(basename "${prefixes[$i]}")"
done
local max_choice=${#prefixes[@]}
read -p "Выберите префикс (1-$max_choice): " choice
read -p "Выберите префикс (0-$max_choice): " choice
if [[ "$choice" -ge 1 && "$choice" -le "$max_choice" ]] ; then
if [[ "$choice" == "0" ]]; then
print_info "Выбор префикса отменен."
exit 0
elif [[ "$choice" -ge 1 && "$choice" -le "$max_choice" ]] ; then
export WINEPREFIX="${prefixes[$choice-1]}"
else
fatal "Неверный выбор."
@@ -1308,7 +1316,7 @@ run_autoinstall () {
remove_prefix() {
export WINEPREFIX="$1"
if [[ -z "$WINEPREFIX" ]]
then print_error "Не указано имя префикса для удаления!"
then print_warning "Не указано имя префикса для удаления. Выберите из списка..."
fi
check_prefix_var
if [[ ! -d "$WINEPREFIX" ]]