;****************************
;----------------------------
; Checks if given program is reachable via the path
; if not abort install
; IN:  #program - to check
; OUT: -

(procedure P_chkrun
  (if
    (= 0 (run ("cd SYS:\nWhich %s" #program)))
    ("")
    (abort ("You must install \"%s\" first !\nIt must be accessible via the path.\nYou can find it in the whdload package." #program))
  )
)

;****************************

(set #program "WHDLoad")
(P_chkrun)

(set #program "RawDIC")
(P_chkrun)

(if
  (= @user-level 2)
  (
    (set #CI_drive
      (askchoice
	(prompt "Select source drive for diskimages")
	(default 0)
	(choices "DF0:" "DF1:" "DF2:" "DF3:")
	(help @askchoice-help)
      )
    )
    (select #CI_drive
      (set #CI_drive "DF0:")
      (set #CI_drive "DF1:")
      (set #CI_drive "DF2:")
      (set #CI_drive "DF3:")
    )
  )
  (set #CI_drive "DF0:")
)

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

(message ("\nPlease note that existing saved games\nmight be overwritten."))
(working)
(run ("RawDIC SLAVE=%ssave.islave SOURCE=%s" @app-name #CI_drive))

(exit)
