#!/bin/sh choosedir() { DIR=`Xdialog --title "Magnetic: Please specify the default directory" --dselect $HOME 0 0 2>&1` case $? in 0) ;; 1) ;; 255) ;; esac } infomsg() { Xdialog --title "Magnetic: run first time" \ --msgbox "It appears this is the first time you're running Magnetic. You'll need to specify a directory where your save files are going to be located. This will also be the start directory for all Magnetic sessions, so it helps a lot if this directory is close to your Magnetic Scrolls datafiles. You can change this setting anytime later by editing the ~/.magnetic-dir file in your home directory with a text editor. Or you can delete it and you will be presented with this dialog again." 15 71 case $? in 0) choosedir;; 255) ;; esac } if [ ! -f ~/.magnetic-dir ]; then infomsg if [ "$DIR" ]; then echo "$DIR" > ~/.magnetic-dir fi fi if [ -f ~/.magnetic-dir ]; then MAGDIR=`cat ~/.magnetic-dir | head -n 1` cd "$MAGDIR" /usr/bin/gtkmagnetic $@ fi