;
; ******************************************************
; *** X-DVE Installation Script V2.60 //  7 Ott 1996 ***
; ******************************************************

(if (= "dansk"      @language) (set lan 0))
(if (= "deutsch"    @language) (set lan 1))
(if (= "english"    @language) (set lan 2))
(if (= "italiano"   @language) (set lan 3))
(if (= "nederlands" @language) (set lan 4))
(if (= "norsk"      @language) (set lan 5))
(if (= "suomi"      @language) (set lan 6))
(if (= "svenska"    @language) (set lan 7))
(if (= "español"    @language) (set lan 8))
(if (= "íslenska"   @language) (set lan 9))
(if (= "greek"      @language) (set lan 10))


(if (= "italiano" @language)
 (
	;/* Italian strings */
	(set #txt01 "Dove vuoi installare il cassetto di X-DVE ?")
	(set #txt02 "\n\n\nCreazione dei cassetti necessari ad X-DVE.")
	(set #txt03 "\n\n\nCancellazione files obsoleti di X-DVE.\nEventuali lavori precedenti (animazioni, scrips, ..) non verranno toccati.")
	(set #txt04 "\n\n\nInstallazione programma X-DVE.\n\nIn questa fase verranno creati tutti i files necessari al funzionamento di X-DVE.\nLa procedura di scompattazione dei files impiegherà qualche secondo.")
	(set #txt05 "Errore durante la scompattazione di X-DVE.")
	(set #txt06 "\n\n\nInstallazione fonts per X-DVE.")
	(set #txt07 "Errore durante la scompattazione dei fonts.")
	(set #txt08 "\n\n\nControllo e riassetto cassetto Fonts (FixFonts).\nOperazione molto consigliata.")
	(set #txt09 "Questa operazione e' molto consigliata in tutti quei casi in cui vengano aggiunti nuovi fonts al sistema.")
	(set #txt10 "\n\n\nInstallazione librerie per X-DVE.")
	(set #txt11 "Errore di installazione librerie.")
	(set #txt12 "\n\n\nCreazione assegnamento per il cassetto X-DVE.\nQuesta operazione permette di agevolare notevolmente l'installazione di future versioni del programma o dei relativi files di supporto, indicando al computer dove e' stato installato X-DVE.")
	(set #txt13 "Modalità di installazione.")
	(set #txt14 "[2pNuova installazione")
	(set #txt15 "Aggiornamento installazione precedente")

	(set #docfile "X-DVE_1:Leggimi.doc")
 )

 (
	;/* Default language (english) */
	(set #txt01 "Where do you wish to install X-DVE drawer ?")
	(set #txt02 "\n\n\nCreation of X-DVE directory structure.")
	(set #txt03 "\n\n\nDeletion of obsolete X-DVE files.\nEventual previous work (animations, scripts, ..) will remain untouched.")
	(set #txt04 "\n\n\nX-DVE program installation\n\nThe installer is going to create all the files needed by X-DVE.\nThis procedure will take some seconds.")
	(set #txt05 "Error while unpacking X-DVE program files.")
	(set #txt06 "\n\n\nX-DVE fonts installation\n\nThe installer is going to create all the fonts needed by X-DVE.\nThis procedure will take some seconds.")
	(set #txt07 "Error while unpacking X-DVE fonts")
	(set #txt08 "\n\n\nThe installer is about to control your fonts.\nOperation highly recommended.")
	(set #txt09 "This operation (AmigaDOS command \"FixFonts\") is highly recommended everytime fonts are added (or deleted) to the system.")
	(set #txt10 "\n\n\nX-DVE libraries installation.")
	(set #txt11 "Error while installing the libraries.")
	(set #txt12 "\n\n\nCreating an assignment to X-DVE.\nThis operation allows to easily install future versions of X-DVE as well as other X-DVE resources.\nIt is safe to do it.")
	(set #txt13 "Installation mode.")
	(set #txt14 "[2pNew installation")
	(set #txt15 "[2pUpdate previous installation")

	(set #docfile "X-DVE_1:Readme.doc")
 )
)



(complete 0)


;/* InstMode selection (instmode = (0 -> install) (1 -> update)) */
(set instmode 0)
(if (<> "" (getassign("X-DVE" "a")))
	(
		(set instmode (askchoice (prompt #txt13)(help @askchoice-help)(choices #txt14 #txt15)(default 1)))
	)
)

;/* Act on InstMode selection */
(if (= 0 instmode)
	(
		(set defdest
			(askdir
				(prompt #txt01)
				(help @askdir-help)
				(default @default-dest)
			)
		)
	)

	(
		(set defdest (getassign("X-DVE" "a")))
	)
)

(set @default-dest defdest)



;/* Check X-DVE.SHP to see if we are already in X-DVE drawer */
(if (= 0 (exists (tackon @default-dest "X-DVE.SHP")))
	(
		(set @default-dest (tackon @default-dest "X-DVE"))
		(makedir @default-dest (infos)(help @makedir-help))
	)
)


;/* make the appropriate X-DVE2 directories */
(message #txt02)
(makedir (tackon @default-dest "AnimBrush")	(help @makedir-help))
(makedir (tackon @default-dest "Brush")		(help @makedir-help))
(makedir (tackon @default-dest "Palette")		(help @makedir-help))
(makedir (tackon @default-dest "Script")		(help @makedir-help))
(makedir (tackon @default-dest "Frames")		(help @makedir-help))
(makedir (tackon @default-dest "XFA")			(help @makedir-help))
(makedir (tackon @default-dest "Fonts")		(help @makedir-help))
(complete 10)


;/* delete old/obsolete X-DVE 1.xx files */
(message #txt03)
(delete (tackon @default-dest "XFA_Util"))
(delete (tackon @default-dest "XFA_Util.info"))
(delete (tackon @default-dest "XFA_Util.doc"))
(delete (tackon @default-dest "XFA_Util.doc.info"))
(delete (tackon @default-dest "X-DVE.prf"))
(complete 20)


;/* copy the latest X-DVE readme document */
(copyfiles 
	(source #docfile)
	(dest @default-dest)
	(prompt)
	(help)
	(infos)
)
(complete 30)


;/* unpack X-DVE and related files */
(message #txt04)
(if (<> 0 (run (cat "X-DVE_1:UNLZX >CON: -m x X-DVE_1:X-DVE.lzx \"" (tackon @default-dest "") "\"")))
	(abort #txt05)
)
(complete 40)


;/* unpack X-DVE default fonts */
(message #txt06)
(if (<> 0 (run "X-DVE_1:UNLZX >CON: -m x X-DVE_1:FONTS.lzx FONTS:"))
	(abort #txt07)
)
(complete 50)


;/* fixfonts is required */
(run "sys:system/FixFonts"
	(prompt #txt08)
	(help #txt09)
	(confirm)
)
(complete 60)


;/* run the InstallLibs script */
(set defdest @default-dest)
(makeassign "X-DVE" defdest)
(message #txt10)
(if (<> 0	(execute "X-DVE:Utils/InstallLibs"))
	(abort #txt11)
)
(complete 80)


;/* Make X-DVE drawer and fonts assignment */
(if (= 0 instmode)
	(
		(set defdest @default-dest)
		(startup "X-DVE"
			(prompt #txt12)
			(help @startup-help)
			(command ("Assign >NIL: X-DVE: \"%s\"\n" defdest))
			(command ("Assign >NIL: FONTS: \"%s\" Add" (tackon defdest "Fonts")))
		)
		(makeassign "X-DVE" defdest)
	)
)

(complete 100)

(exit)
