(set #CI_unit 0)
(set #CI_drive ("DF%ld:" #CI_unit))

; Ask the user what to install
(set #install-datadisks
	(askoptions
		(prompt	"Which data disk do you want to install ?")
		(help	@askoptions-help)
		(choices
			"Program Disk"
			"Original Levels"
			"Payoff Levels"
		)
	)
)

;----------------------------

(set @default-dest
(askdir
	(prompt ("Where should %s installed ?\nA drawer \"%s\" will automatically created." @app-name @app-name))
	(help @askdir-help)
	(default @default-dest)
	(disk)
)
)

(set #dest (tackon @default-dest @app-name))


(makedir #dest
	(help @makedir-help)
	(infos)
)

;----------------------------


(copyfiles
	(help @copyfiles-help)
	(source "cadaverhd.readme.info")
	(dest #dest)
)

(copyfiles
	(help @copyfiles-help)
	(source "cadaverhd.readme")
	(dest #dest)
)

(if (BITAND #install-datadisks 1)
    (
        (message ("\nInsert %s Program Disk into drive %s !" @app-name #CI_drive))
        	(if
	        	(= 0 (run ("disk2file %ld \"%s/Cadaver.disk1\" >con:///1000//CLOSE/WAIT" #CI_unit #dest )))
		        ("")
        		(abort "\"disk2file\" must be in your PATH !")
        	)
    )

)


(if (BITAND #install-datadisks 2)
    (
        (copyfiles
	        (help @copyfiles-help)
        	(source "CadaverHD")
	        (dest #dest)
        )
        (copyfiles
	        (help @copyfiles-help)
        	(source "CadaverHD.info")
        	(dest #dest)
        )

        (message ("\nInsert %s Original Levels into drive %s !" @app-name #CI_drive))
        	(if
	        	(= 0 (run ("disk2file %ld \"%s/Cadaver.disk2\" >con:///1000//CLOSE/WAIT" #CI_unit #dest )))
		        ("")
        		(abort "\"disk2file\" must be in your PATH !")
        	)
    )

)

(if (BITAND #install-datadisks 4)
    (
        (copyfiles
	        (help @copyfiles-help)
        	(source "PayoffHD")
	        (dest #dest)
        )
        (copyfiles
	        (help @copyfiles-help)
        	(source "PayoffHD.info")
        	(dest #dest)
    )

        (message ("\nInsert %s The Payoff Levels into drive %s !" @app-name #CI_drive))
        	(if
	        	(= 0 (run ("disk2file %ld \"%s/Cadaver.disk3\" >con:///1000//CLOSE/WAIT" #CI_unit #dest )))
		        ("")
        		(abort "\"disk2file\" must be in your PATH !")
    	  	)
      )


)
(exit)

