Improve wine install path selection

This commit is contained in:
the-sane 2024-10-08 00:01:05 -04:00
parent 940a5703fe
commit 579fc737d8

View File

@ -2528,23 +2528,48 @@ install_game_wine() {
install_dir="$HOME/Games/star-citizen" install_dir="$HOME/Games/star-citizen"
else else
if [ "$use_zenity" -eq 1 ]; then if [ "$use_zenity" -eq 1 ]; then
message info "On the following screen, select your Star Citizen install location.\n\nA new subdirectory named 'star-citizen' will be created in the selected location." if message options "Create my own prefix dir" "Continue" "After clicking Continue, select your Star Citizen install location.\nA new subdirectory named 'star-citizen' will be created in the selected location. This will be your wine prefix.\n\nIf you know what you are doing and want to create your own prefix directory, choose \"Create my own prefix dir\""; then
# Default, create the star-citizen directory
install_prefix="star-citizen"
else
# User will create their own prefix directory
install_prefix=""
fi
# Get the install path from the user # Get the install path from the user
install_dir="$(zenity --file-selection --directory --title="Choose your Star Citizen install directory" --filename="$HOME/" 2>/dev/null)" while true; do
if [ "$?" -eq -1 ]; then install_dir="$(zenity --file-selection --directory --title="Choose your Star Citizen install directory" --filename="$HOME/" 2>/dev/null)"
message error "An unexpected error has occurred. The Helper is unable to proceed."
return 1 if [ "$?" -eq -1 ]; then
elif [ -z "$install_dir" ]; then message error "An unexpected error has occurred. The Helper is unable to proceed."
# User clicked cancel return 1
message warning "Installation cancelled." fi
return 1 if [ -z "$install_dir" ]; then
fi # User clicked cancel
message warning "Installation cancelled."
return 1
fi
# Add the wine prefix subdirectory to the install path
if [ -n "$install_prefix" ]; then
install_dir="$install_dir/$install_prefix"
fi
# Sanity check the chosen directory a bit to catch some possible mistakes
if [ "$install_dir" = "/" ] || [ "$install_dir" = "$HOME" ] || [ "$install_dir" = "$HOME/Games" ]; then
if message question "Something seems off! This directory will become your wine prefix. Are you really sure this is what you want?\n\n$install_dir"; then
break
fi
else
# All good, break out of the loop and continue
break
fi
done
else else
# No Zenity, use terminal-based menus # No Zenity, use terminal-based menus
clear clear
# Get the install path from the user # Get the install path from the user
printf "Enter the desired Star Citizen install path (case sensitive)\nie. /home/USER/Games\n\nA new subdirectory named 'star-citizen' will be created in the location entered.\n\n" printf "Enter the desired Star Citizen install path (case sensitive)\nie. /home/USER/Games/star-citizen\n\n"
while read -rp "Install path: " install_dir; do while read -rp "Install path: " install_dir; do
if [ -z "$install_dir" ]; then if [ -z "$install_dir" ]; then
printf "Invalid directory. Please try again.\n\n" printf "Invalid directory. Please try again.\n\n"
@ -2557,9 +2582,6 @@ install_game_wine() {
fi fi
done done
fi fi
# Set the game subdirectory
install_dir="$install_dir/star-citizen"
fi fi
# Create the game path # Create the game path
@ -2683,9 +2705,11 @@ install_game_wine() {
install_powershell() { install_powershell() {
if message question "Run the Preflight Check to update winetricks before proceeding!\n\nDo you want to continue?"; then if message question "Run the Preflight Check to update winetricks before proceeding!\n\nDo you want to continue?"; then
getdirs getdirs
debug_print continue "Installing PowerShell into ${wine_prefix}..." if [ "$?" -ne 1 ]; then
WINEPREFIX="$wine_prefix" winetricks -q powershell debug_print continue "Installing PowerShell into ${wine_prefix}..."
message info "PowerShell operation complete. See terminal output for details." WINEPREFIX="$wine_prefix" winetricks -q powershell
message info "PowerShell operation complete. See terminal output for details."
fi
fi fi
} }