;------------------------------------------------------------------------
; DoDIZ v3.0 -> v3.0a patch script. Jonas Kjellin
;------------------------------------------------------------------------
(message 
	(cat 	"This script will update DoDIZ v3.0 to v3.0a.\n\n"
			"(A backup of the old DoDIZ will be created called DoDIZ.old. "
			"You can delete it after this script has been run with no problems.)"
	)
)

(set olddodiz 
	(askfile 
		(prompt "Please locate the DoDIZ v3.0 program!")
		(default "C:")
		(help @askfile-help)
	)
)

(if (<> (exists olddodiz (noreq)) 1)
(
    (abort (cat "Couldn't locate " olddodiz))
))

(set size (getsize olddodiz))

(if (and (<> size 39264) (<> size 39312))
(
    (abort (cat ("%s isn't the real DoDIZv3.0." olddodiz)))
))


(set @default-dest (pathonly olddodiz))

(rename olddodiz (tackon @default-dest "DoDIZ_old"))

(if (= size 39312)
    (set patchfile "DoDIZv3a_020.pch")
    (set patchfile "DoDIZv3a.pch")
)

(working "Updating DoDIZ to v3.0a")

(run ("spatch -o%s -p%s %s" (tackon @default-dest "DoDIZ") patchfile (tackon @default-dest "DoDIZ_old")))

(complete 100)

