; $VER: Installer script for DefIcons44 1.4 (23.06.00) © 1999/2000 by Stephan Rupprecht

;--- localize strings ----
(if (= @language "deutsch")
(
	(set #wrongver "DefIcons44 benötigt OS3.5 oder besser !!!")
	(set #askdir_mainprg "Wohin soll das Hauptprogramm (DefIcons44) kopiert werden?")
	(set #askdir_prefs "Bitte wählen Sie das Zielverzeichnis für das Voreinstellungsprogramm")
	(set #copy_config "Soll eine der mitgelieferten deficons.prefs Dateien installiert werden?")
	(set #std_prefs "Standard (langsam aber genau)")
	(set #alt_prefs "Optimiert (schnell, nicht so genau)")
	(set #no_prefs "Diesen Teil überspringen")
)
(
	
	(set #wrongver "DefIcons44 requires OS3.5 or better !!!")
	(set #askdir_mainprg "Please select the destination drawer for DefIcons44")
	(set #askdir_prefs "Please select the drawer for the preferences editor")
	(set #copy_config "Do you wish to install one of the supplied deficons.prefs files?")
	(set #std_prefs "Standard (slow but accurate)")
	(set #alt_prefs "Optimized (fast, not so accurate)")
	(set #no_prefs "Skip this part")
)
)

;--- check os version ---
(set #vernum (getversion "workbench.library" (resident)))
(set #vernum (/ #vernum 65536))

(if(< #vernum 44)
	(abort #wrongver)
)

;--- askdir for main program ---
(set @default-dest
	(askdir
		(prompt #askdir_mainprg)
		(help @askdir-help)
		(default "SYS:WBStartup")
	)
)

;--- askdir for prefs program ---
(set #prefs-dir
	(askdir
		(prompt #askdir_prefs)
		(help @askdir-help)
		(default "SYS:Prefs")
	)
)

;--- copy mainprg ---
(copyfiles
	(help @copyfiles-help)
	(source "DefIcons44")
	(dest @default-dest)
)


;--- copy .info file if neccessary ---
(set #info_path (tackon @default-dest "DefIcons44.info") )

(if (not (exists #info_path) )
	(copyfiles
		(help @copyfiles-help)
		(source "DefIcons44.info")
		(dest @default-dest)
	)
)

;--- copy prefsed ---
(copyfiles
	(help @copyfiles-help)
	(source "DefIconsPrefs")
	(dest #prefs-dir)
)

;--- copy catalog ---
(if (NOT (= @language "english")) 
(
	(set #src_name
		(tackon "Catalogs/" @language)
	)

	(set #dst_name
		(tackon "LOCALE:" #src_name)
	)

	(set #src_name
		(tackon #src_name "deficonsprefs.catalog")
	)

	(if (exists #src_name (noreq))
	(
		(copyfiles
			(help @copyfiles-help)
			(source #src_name)
			(dest #dst_name)
		)
	)
		(message "Sorry, there is no " @language " catalog available at the moment!")
	) 
)
)

;--- copy .info file if neccessary ---
(set #info_path (tackon #prefs-dir "DefIconsPrefs.info") )

(if (not (exists #info_path) )
	(copyfiles
		(help @copyfiles-help)
		(source "DefIconsPrefs.info")
		(dest #prefs-dir)
	)
)

;--- copy deficons.prefs ? ---
(if (exists "envarc:deficons.prefs")
(
	(set defchoice 0)
)
(
	(set defchoice 1)
)
)

(set res (askchoice
		(prompt #copy_config)
		(help @askchoice-help)
		(choices #no_prefs #std_prefs #alt_prefs)
		(default defchoice)
	)
)

(if (> res 0)
	(if (= res 1)
	(
		(copyfiles
			(help @copyfiles-help)		
			(source "deficons.prefs")
			(dest "envarc:")
		)
	)
	(
		(copyfiles
			(help @copyfiles-help)		
			(source "alt/deficons.prefs")
			(dest "envarc:")
		)
	)
	)
)

;--- copy processfile.rexx ...

(if (not (exists "REXX:ProcessFile.REXX") )
	(copyfiles
		(help @copyfiles-help)
		(source "s/ProcessFile.REXX")
		(dest "REXX:")
	)
)

;--- and DoMIME

(copyfiles
	(help @copyfiles-help)
	(source "DoMIME")
	(dest "C:")
)

;--- eof ---
