; Installer script for the RaveScope
;
; 10.9.1998 by Parsec
;



(procedure P_MAKEDIR #dir			; Create a directory, with icon depending on if the
    (if (IN #INSTMASK 1)			; user has asked for icons to be created.
	(makedir #dir (infos))
	(makedir #dir)
    )
)



(if (= (set #DCFGDIR (getenv "DELICONFIG")) "")	; Try to find delitracker's genie dir
    (set #DELIDIR "work:")
    ((set #DELIDIR (tackon (substr #DCFGDIR 0 (- (strlen #DCFGDIR) 11)) "DeliGenies"))
	(if (= (exists #DELIDIR) 0) (set #DELIDIR "work:")))
)

(set #RAVEDIR
    (tackon
	(askdir
	    (prompt "Where do you want to install the RaveScope? A drawer called \"RaveScope\" will be created there.")
	    (help (cat @askdir-help))
	    (default "work:")
	)   "RaveScope"
    )
)

;(if (< 0 @user-level)

(set #INSTMASK
    (askoptions 
	(prompt "What of the following do you want to install?")
	(choices
	    "Documentation"
	    "Ravescope icons"
	    "Delitracker genie"
	    "Eagleplayer engine"
	    "Developer stuff")
	(default %01111)
	(help (cat "Documentation: RaveScope.guide and RaveScope.readme.\n\n" 
	    "Ravescope icons: Icons for the RaveScope executable and subdirs.\n\n"
	    "Delitracker genie: If you want to use the RaveScope with Delitracker.\n\n"
            "Eagleplayer engine: If you want to use the RaveScope with Eagleplayer.\n\n"
            "Developer stuff: If you want to write a RaveScope plugin for your musicplayer.\n\n"
	    @askoptions-help))
    )
)

(P_MAKEDIR #RAVEDIR)				; Create the RaveScope main directory

(if (IN #INSTMASK 0)
    (set #DOCDIR
	(askdir
	    (prompt "Where do you want to install the documentation? No drawer will be created.")
	    (default (tackon #RAVEDIR "Docs"))
	    (newpath)
	    (help @askdir-help)
	)
    )
)


(if (IN #INSTMASK 2)
    (set #DELIDIR
	(askdir
	    (prompt "Where do you want to install the Delitracker genie?")
	    (default #DELIDIR)
	    (help (cat "Delitracker genie directory: The directory where you keep your Delitracker "
		"genies. This is usually a subdir in the Delitracker directory called Deligenies. "
		"If you don't want Delitracker to launch the Ravescope every time it is started, then "
		"put it in Deligenies/GenieStore.\n\n"
		@askdir-help))
	)
    )
)


(if (IN #INSTMASK 3)
    (set #EAGLEDIR
	(askdir
	    (prompt "Where do you want to install the Eagleplayer engine?")
	    (default "Eagleplayer2:Engines")
	    (help (cat "Eagleplayer directory: The directory where you keep your Eagleplayer "
		"engines. This is usually a subdir in the Eagleplayer directory called Engines.\n\n"
		@askdir-help))
	)
    )
)

;
;
;
; All questions asked, now copy everything.
;
;
;

(set #DEVDIR (tackon #RAVEDIR "Developer"))
(copyfiles (dest #RAVEDIR) (source "RaveScope"))

(if (IN #INSTMASK 0)
    ((if (= (exists #DOCDIR) 0)	(P_MAKEDIR #DOCDIR))
    (copyfiles (dest #DOCDIR) (source "Docs/RaveScope.guide"))
    (copyfiles (dest #DOCDIR) (source "Docs/RaveScope.readme")))
)

(if (IN #INSTMASK 1)
    (copyfiles (dest #RAVEDIR) (source "RaveScope.info"))
)

(if (IN #INSTMASK 2)
    (copyfiles (dest #DELIDIR) (source "Delitracker/RaveScope"))
)

(if (IN #INSTMASK 3)
    (copyfiles (dest #EAGLEDIR) (source "Eagleplayer/RaveScope"))
)

(if (IN #INSTMASK 4)
    ((P_MAKEDIR #DEVDIR)
    (copyfiles (dest #DEVDIR) (all) (source "developer")))
)



