From 00dc0191b6f0e74f8c259aceaf2f3f3579a70f1a Mon Sep 17 00:00:00 2001 From: Nicole George Date: Mon, 10 Feb 2020 01:10:54 -0600 Subject: [PATCH] Fixed symlink issue Fixed issue where if you cancelled the themes selection dialog box, it would symlink all folders of the root directory in your Worlds folder. --- launch.sh | 54 +++++++++++++++++++++++++++++++++--------------------- 1 file changed, 33 insertions(+), 21 deletions(-) diff --git a/launch.sh b/launch.sh index e3cd884..0a61bd7 100644 --- a/launch.sh +++ b/launch.sh @@ -37,34 +37,46 @@ main() { 'Backup Worlds files') mkdir -p "$WORLDSDIR/backup" bkup=$(zenity --file-selection --title="Select Backup folder to backup to" --directory --filename="$WORLDSDIR/backups/" --save) - echo "$WORLDSINSTALL/worlds.ini >> $bkup/worlds.ini" - cp -r "$WORLDSINSTALL/worlds.ini" "$bkup/worlds.ini" - echo "$WORLDSINSTALL/gamma.avatars >> $bkup/gamma.avatars" - cp -r "$WORLDSINSTALL/gamma.avatars" "$bkup/gamma.avatars" - echo "$WORLDSINSTALL/gamma.worldsmarks >> $bkup/gamma.worldsmarks" - cp -r "$WORLDSINSTALL/gamma.worldsmarks" "$bkup/gamma.worldsmarks" - main ;; + if [[ $? -eq 1 ]]; then + main + else + echo "$WORLDSINSTALL/worlds.ini >> $bkup/worlds.ini" + cp -r "$WORLDSINSTALL/worlds.ini" "$bkup/worlds.ini" + echo "$WORLDSINSTALL/gamma.avatars >> $bkup/gamma.avatars" + cp -r "$WORLDSINSTALL/gamma.avatars" "$bkup/gamma.avatars" + echo "$WORLDSINSTALL/gamma.worldsmarks >> $bkup/gamma.worldsmarks" + cp -r "$WORLDSINSTALL/gamma.worldsmarks" "$bkup/gamma.worldsmarks" + main + fi ;; 'Restore last backup') mkdir -p "$WORLDSDIR/backup" rbkup=$(zenity --file-selection --title="Select Backup folder to restore from" --directory --filename="$WORLDSDIR/backups/") - echo "$rbkup/worlds.ini >> $WORLDSINSTALL/worlds.ini" - cp -r "$rbkup/worlds.ini" "$WORLDSINSTALL/worlds.ini" - echo "$rbkup/gamma.avatars >> $WORLDSINSTALL/gamma.avatars" - cp -r "$rbkup/gamma.avatars" "$WORLDSINSTALL/gamma.avatars" - echo "$rbkup/gamma.worldsmarks >> $WORLDSINSTALL/gamma.worldsmarks" - cp -r "$rbkup/gamma.worldsmarks" "$WORLDSINSTALL/gamma.worldsmarks" - main ;; + if [[ $? -eq 1 ]]; then + main + else + echo "$rbkup/worlds.ini >> $WORLDSINSTALL/worlds.ini" + cp -r "$rbkup/worlds.ini" "$WORLDSINSTALL/worlds.ini" + echo "$rbkup/gamma.avatars >> $WORLDSINSTALL/gamma.avatars" + cp -r "$rbkup/gamma.avatars" "$WORLDSINSTALL/gamma.avatars" + echo "$rbkup/gamma.worldsmarks >> $WORLDSINSTALL/gamma.worldsmarks" + cp -r "$rbkup/gamma.worldsmarks" "$WORLDSINSTALL/gamma.worldsmarks" + main + fi ;; 'Set theme' ) seltheme=$(zenity --file-selection --title="Select a theme folder" --directory --filename="$WORLDSDIR/themes/") - for i in $seltheme/*; - do FILENAME="$(basename $i)" - echo "$seltheme/$FILENAME >> $WORLDSINSTALL/$FILENAME" - ln -sf "$seltheme/$FILENAME" "$WORLDSINSTALL/$FILENAME" - done - main ;; + if [[ $? -eq 1 ]]; then + main + else + for i in $seltheme/*; + do FILENAME="$(basename $i)" + echo "$seltheme/$FILENAME >> $WORLDSINSTALL/$FILENAME" + ln -sf "$seltheme/$FILENAME" "$WORLDSINSTALL/$FILENAME" + done + main + fi ;; 'Clear Cache') rm -rf "$WORLDSINSTALL/cachedir" - main ;; + main ;; esac }