Better backup directory prompts

This commit is contained in:
the-sane 2020-11-21 08:42:07 -05:00 committed by GitHub
parent 2fda35d5cb
commit 5bad74bfa6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -318,11 +318,19 @@ getdirs() {
# Get the backup directory # Get the backup directory
if [ -z "$backup_path" ]; then if [ -z "$backup_path" ]; then
backup_path="$(zenity --file-selection --directory --title="Select a backup directory for your keybinds" --filename="$HOME/")" while backup_path="$(zenity --file-selection --directory --title="Select a directory to back up your keybinds into" --filename="$HOME/")"; do
if [ "$?" -eq -1 ]; then if [ "$?" -eq -1 ]; then
message warning "An unexpected error has occurred. The helper is unable to proceed." message warning "An unexpected error has occurred. The helper is unable to proceed."
return 1 return 1
elif [ -z "$backup_path" ]; then elif [ "$backup_path" = "$game_path" ]; then
message warning "Please select a backup location outside your Star Citizen directory.\nie. /home/USER/backups/"
else
# All good or cancel
break
fi
done
if [ -z "$backup_path" ]; then
# User clicked cancel # User clicked cancel
message warning "Operation cancelled.\nNo changes have been made to your game." message warning "Operation cancelled.\nNo changes have been made to your game."
return 1 return 1
@ -350,7 +358,7 @@ getdirs() {
if [ ! -d "$game_path" ]; then if [ ! -d "$game_path" ]; then
echo -e "That directory is invalid or does not exist. Please try again.\n" echo -e "That directory is invalid or does not exist. Please try again.\n"
elif [ "$(basename "$game_path")" != "Star Citizen" ] && [ "$(basename "$game_path")" != "StarCitizen" ]; then elif [ "$(basename "$game_path")" != "Star Citizen" ] && [ "$(basename "$game_path")" != "StarCitizen" ]; then
echo -e "You must enter the full path to the directory named 'Star Citizen'" echo -e "You must enter the full path to the directory named 'StarCitizen'\n"
else else
break break
fi fi
@ -364,6 +372,8 @@ getdirs() {
while read -rp ": " backup_path; do while read -rp ": " backup_path; do
if [ ! -d "$backup_path" ]; then if [ ! -d "$backup_path" ]; then
echo -e "That directory is invalid or does not exist. Please try again.\n" echo -e "That directory is invalid or does not exist. Please try again.\n"
elif [ "$backup_path" = "$game_path" ]; then
echo -e "Please select a backup location outside your Star Citizen directory.\nie. /home/USER/backups/\n"
else else
break break
fi fi