;+-----------------------------------------------+
;|        SymBase Installer Script V 1.0         |
;|                                               |
;|             by Lázi in 1998.12.30.            |
;+-----------------------------------------------+


(if (not (= @language "magyar"))
	(
        (set #noconfig "Can't locate AmosPro config file, so you must install the SymBase extension manually.\nLook out your AmosPro manual, how to install an extension.\nThis installer needs the S:AmosPro_Interpreter_Config file.")
        (set #reserved "In your current configuration, an extension already using the extension slot of SymBase.\n\nWould you like to change this slot?")
	(set #res-help "The SymBase extension developed to use the 21th extension slot. In your current configuration this slot is used by another extension (or probably an earlier version of Symbase). If you change this slot to SymBase, you can no longer use the extension, which is currently use the 21th slot.\n\nThe current extension:")
	(set #txt-doc  "Would you like to install SymBase docs and demo programs?")
	(set #doc-help "If you choose no, only the extension will be installed!")
	(set #where    "Where should I install the SymBase related files?\nA new directory will be created.")
)
)

(if (= @language "magyar")
	(
	(set #noconfig "Nem találom az AmosPro konfigurációs fájlt, így a Symbase extension-t kézi úton kell telepíteni.\nNézd meg az AmosPro kézikönyvet, hogyan lehet új extension-t telepíteni.\nEnnek a telepítőnek szüksége van a S:AmosPro_Interpreter_Config fájlra.")
        (set #reserved "Egy extension már használja a SymBase helyét.\n\nKivánod, hogy lecseréljem a SymBase-rec?")
	(set #res-help "A SymBase extension a 21. extension rekesz részére készült. A jelenlegi Amos beállításokban egy másik extension használja ezt a rekeszt (vagy lehet, hogy a SymBase egy korábbi változata). Ha a  SymBase-t, rakjuk ebbe a rekeszbe, akkor nem lehet tovább használni azt az extension-t, amelyik mindeddig a 21. rekeszben volt.\n\nA jelenlegi extension:")
	(set #txt-doc  "Telepítésre kerüljenek a dokumentációk és a példaprogramok is?")
	(set #doc-help "Ha nemmel válaszol, akkor csak az AmosPro extension kerül telepítésre!")
	(set #where    "Hová telepítsem a SymBase fájlokat?\nEgy új alkönyvtár lesz létrehozva.")
)
)

(set #name "#")
(set #libname "SBASE_EX")
(set #newlibname "AmosPro_SymBase.Lib")
(set #configname "S:AmosPro_Interpreter_Config")

;------- megvan-e a config file, ami a libinstall-nak kell ---------------

(if (not (exists #configname))
       (exit #noconfig)
)
(if (exists "libinstall")
	(run "libinstall check extnr=21")
)

;------- az extension telepitesenek helye --------------------------------

(if (askbool (prompt #txt-doc) (help #doc-help))
(while (not (exists #name))
(set #name
	(askdir
		(prompt #where)
		(help @askdir-help)
		(default "AmosPro_System:AmosPro_Productivity2")
	)
)
(if (not (exists #name))
	(message "The selected path not valid!\nSelect 'Proceed' to go back.")
)
)
(set #name "")
)

(set #extname (getenv "extname"))

(if (> #extname "")
	(if (askbool
		(prompt #reserved )
		(help #res-help #extname)
	    )
		(run "libinstall change extnr=21 libname=AmosPro_SymBase.Lib")
		(copyfiles
			(source #libname)
			(dest "AmosPro_System:APSystem/")
			(newname #newlibname)
		)
	    (message "You may look it up the SymBase documentation, how to install manually.")
	)
	(
		(run "libinstall change extnr=21 libname=AmosPro_SymBase.Lib")
		(copyfiles
			(source #libname)
			(dest "AmosPro_System:APSystem/")
			(newname "AmosPro_SymBase.Lib")
		)

	)
)
(if (not (= #name ""))
	(copyfiles
		(source "Comp")
		(dest #name)
		(all)
		(infos)
		(noposition)
	)
)
(delete "env:extname")
