; Installation script for TrapListPrefs

(set @user-level 2)

(transcript "Applying TrapListPrefs (BGUI)1.2 to 1.2a Patch...")

(set destdir
        (askdir
                (prompt "This patch will update your BGUI version of\nTrapListPrefs to 1.2a?")
                (help @askdir-help)
                (default "SYS:Prefs")
        )
)

( if (= (exists (tackon destdir "TrapListPrefs") (noreq)) 1)
    (
		if (= (run (cat "spatch -pBGUITrapListPrefs.pch \"" (tackon destdir "TrapListPrefs\"")) ) 0)
            (
				(rename (tackon destdir "TrapListPrefs") (tackon destdir "TrapListPrefs.old"))
				(copyfiles
				    (source "TrapListPrefs.new")
				    (dest destdir)
					(newname "TrapListPrefs")
				)
				(set delold
				    (askbool
				            (prompt "Do you want my to delete the old version?\n"
				                    "If you select NO, the old version can be\n"
				                    "found in the same directory as the new one\n"
				                    "but will have been renamed TrapListPrefs.old")
				            (help "It's up to YOU.")
				            (choices "Yes" "No")
				            (default 0)              ; 0 = no
				    )
				)
				(if (= delold 1)
					( delete (tackon destdir "TrapListPrefs.old"))
				)
			)
			(
				(exit "An error occured while applying the patch" )
			)
	)
)
(
	(exit "Unable to find TrapListPrefs" )
)

(set @default-dest destdir)

(exit ("Please remember TrapListPrefs is shareware,\nsee docs for information about registering."))

