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.
This commit is contained in:
Nicole George 2020-02-10 01:10:54 -06:00 committed by GitHub
parent 289d1d113d
commit 00dc0191b6

View File

@ -37,34 +37,46 @@ main() {
'Backup Worlds files') 'Backup Worlds files')
mkdir -p "$WORLDSDIR/backup" mkdir -p "$WORLDSDIR/backup"
bkup=$(zenity --file-selection --title="Select Backup folder to backup to" --directory --filename="$WORLDSDIR/backups/" --save) bkup=$(zenity --file-selection --title="Select Backup folder to backup to" --directory --filename="$WORLDSDIR/backups/" --save)
echo "$WORLDSINSTALL/worlds.ini >> $bkup/worlds.ini" if [[ $? -eq 1 ]]; then
cp -r "$WORLDSINSTALL/worlds.ini" "$bkup/worlds.ini" main
echo "$WORLDSINSTALL/gamma.avatars >> $bkup/gamma.avatars" else
cp -r "$WORLDSINSTALL/gamma.avatars" "$bkup/gamma.avatars" echo "$WORLDSINSTALL/worlds.ini >> $bkup/worlds.ini"
echo "$WORLDSINSTALL/gamma.worldsmarks >> $bkup/gamma.worldsmarks" cp -r "$WORLDSINSTALL/worlds.ini" "$bkup/worlds.ini"
cp -r "$WORLDSINSTALL/gamma.worldsmarks" "$bkup/gamma.worldsmarks" echo "$WORLDSINSTALL/gamma.avatars >> $bkup/gamma.avatars"
main ;; 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') 'Restore last backup')
mkdir -p "$WORLDSDIR/backup" mkdir -p "$WORLDSDIR/backup"
rbkup=$(zenity --file-selection --title="Select Backup folder to restore from" --directory --filename="$WORLDSDIR/backups/") rbkup=$(zenity --file-selection --title="Select Backup folder to restore from" --directory --filename="$WORLDSDIR/backups/")
echo "$rbkup/worlds.ini >> $WORLDSINSTALL/worlds.ini" if [[ $? -eq 1 ]]; then
cp -r "$rbkup/worlds.ini" "$WORLDSINSTALL/worlds.ini" main
echo "$rbkup/gamma.avatars >> $WORLDSINSTALL/gamma.avatars" else
cp -r "$rbkup/gamma.avatars" "$WORLDSINSTALL/gamma.avatars" echo "$rbkup/worlds.ini >> $WORLDSINSTALL/worlds.ini"
echo "$rbkup/gamma.worldsmarks >> $WORLDSINSTALL/gamma.worldsmarks" cp -r "$rbkup/worlds.ini" "$WORLDSINSTALL/worlds.ini"
cp -r "$rbkup/gamma.worldsmarks" "$WORLDSINSTALL/gamma.worldsmarks" echo "$rbkup/gamma.avatars >> $WORLDSINSTALL/gamma.avatars"
main ;; 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' ) 'Set theme' )
seltheme=$(zenity --file-selection --title="Select a theme folder" --directory --filename="$WORLDSDIR/themes/") seltheme=$(zenity --file-selection --title="Select a theme folder" --directory --filename="$WORLDSDIR/themes/")
for i in $seltheme/*; if [[ $? -eq 1 ]]; then
do FILENAME="$(basename $i)" main
echo "$seltheme/$FILENAME >> $WORLDSINSTALL/$FILENAME" else
ln -sf "$seltheme/$FILENAME" "$WORLDSINSTALL/$FILENAME" for i in $seltheme/*;
done do FILENAME="$(basename $i)"
main ;; echo "$seltheme/$FILENAME >> $WORLDSINSTALL/$FILENAME"
ln -sf "$seltheme/$FILENAME" "$WORLDSINSTALL/$FILENAME"
done
main
fi ;;
'Clear Cache') 'Clear Cache')
rm -rf "$WORLDSINSTALL/cachedir" rm -rf "$WORLDSINSTALL/cachedir"
main ;; main ;;
esac esac
} }