; Installation program for the Commodore's Installer utility

(set local-help (cat "If you choose \"Yes\" you can have CatchDisk send its"
				     " messages in italian.\nIf you choose \"No\", CatchDisk will"
					 " only run in english.\nNote that if your system language"
					 " is not set to 'italiano' you will still see all the "
					 "messages in english"))

(complete 0)

(if (exists "L:WBStart-Handler")
	((set ver (/ (getversion "L:WBStart-Handler") 65536))
     (set rev (- (getversion "L:WBStart-Handler") (* 65536 ver)))
     (if (< ver 2)
         (if (< rev 4)
             (message (cat "Warning: you must install WBStart-Handler "
						"version 1.4 or later to be able to use "
						"CatchDisk (see the 'Readme' file).")
             )
		 )
     )
    )
	(message (cat "Warning: you must install WBStart-Handler "
				  "version 1.4 or later to be able to use "
				  "CatchDisk (see the 'Readme' file).")
    )
)

(set name
	(askdir
		(prompt "Where do you want to install CatchDisk ?")
		(help @askdir-help)
		(default "SYS:WBStartup")
	)
)

(set @default-dest name)

(set vernum (/ (getversion) 65536))   ; se version >37: c' localizzazione

(if (> vernum 37)
	(set local
		(askbool
			(prompt "Do you want to install the support file for the italian language ?")
			(help local-help)
			(default 0)
		)
	)
	(set local 0)
)

(if local
	(if (and (= @user-level 2) (exists "LOCALE:catalogs/italiano"))
		(set sysdest
			(askchoice
				(prompt "Where do you want to install the localization file ?")
				(help @askchoice-help)
				(choices "in the same drawer as CatchDisk" "in LOCALE:")
				(default 1)
			)
		)
		(if (= name "SYS:WBStartup")
			(set sysdest 1)
			(set sysdest 0)
		)
	)
)

(if (not (exists "LOCALE:catalogs/italiano"))
	(set sysdest 0)
)

(complete 50)

(copyfiles
	(infos)
	(source "/CatchDisk")
    (dest name)
)

(tooltype
    (dest (tackon name "CatchDisk"))
	(noposition)
)

(complete 80)

(if local
 	(if sysdest
		(copyfiles
			(source "/catalogs/italiano/CatchDisk.catalog")
			(dest "LOCALE:catalogs/italiano")
		)
        (
			(makedir (tackon name "catalogs"))
			(copyfiles
				(source "/catalogs/italiano/CatchDisk.catalog")
				(dest (tackon name "catalogs/italiano"))
            )
		)
    )
)

(complete 100)
