;-------------------------------------------------
; HD Installation script for Tracks&Fields
; Copyright © 1996 by Dick Roström.
; Written by Dick Roström.
;-------------------------------------------------
;$VER: Tracks&Fields HDInstall 1.0 ()

; Check kickversion.
;-------------------

  (if (< (/ (getversion) 65536) 39)
   (abort "Tracks&Fields will only run under Kickstart 3.0 or above!")
  )

; Select drawer.
;---------------

  (welcome)
  (set @default-dest (getassign "TF" "dva"))
  (if (= @default-dest "")
   ((set @default-dest (getassign "Work" "dva"))
    (if (= @default-dest "") (set @default-dest (getassign "SYS" "dva")))
    (set @default-dest (askdir (prompt "Please select a drive or drawer where\nTracks&Fields should be installed!\nA drawer will be created there.")
    (help "In this location a drawer will be created. All files except the libraries and the font will be installed inside this drawer.")
    (default @default-dest)))
    (set @default-dest (tackon @default-dest "Tracks&Fields"))
   )
   ((set bool (askbool (prompt "Installing Tracks&Fields in\n" @default-dest) (default 1) (help @askbool-help)))
    (if (= bool 0)
     ((set @default-dest (getassign "SYS" "dva"))
      (set @default-dest (askdir (prompt "Please select a drive or drawer where\nTracks&Fields should be installed!\nA drawer will be created there.")
      (help "In this location a drawer will be created. All files except the libraries will be installed inside this drawer.")
      (default @default-dest)))
      (set @default-dest (tackon @default-dest "Tracks&Fields"))
     )
    )
   )
   )

; Copy Musicline Editor files to main dir.
;-----------------------------------------

  (working "Checking for Tracks&Fields files.")
  (copyfiles (prompt "Install Tracks&Fields.")
   (source "Tracks&Fields")
   (dest @default-dest)
   (pattern "#?")
   (files)
   (infos)
   (optional fail)
   (confirm)
   (help @copyfiles-help)
  )
  (set Destination (substr @default-dest 0 (- (strlen @default-dest) 15)))

; Copy Commands.
;------------------

  (working "Checking for commands.")
  (makedir (tackon @default-dest "Commands"))
  (if (= (exists "Tracks&Fields/Commands" (noreq)) 2)
   (copyfiles (prompt "Install Commands.")
    (source "Tracks&Fields/Commands")
    (dest (tackon @default-dest "Commands"))
    (all)
    (optional fail force)
    (confirm)
    (help @copyfiles-help)
   )
  )

; Copy Songs.
;------------------

  (working "Checking for songs.")
  (makedir (tackon @default-dest "Songs"))
  (if (= (exists "Tracks&Fields/Songs" (noreq)) 2)
   (copyfiles (prompt "Install Songs.")
    (source "Tracks&Fields/Songs")
    (dest (tackon @default-dest "Songs"))
    (all)
    (optional fail force)
    (confirm)
    (help @copyfiles-help)
   )
  )

; Copy Source.
;------------------

  (working "Checking for source.")
  (makedir (tackon @default-dest "Source"))
  (if (= (exists "Tracks&Fields/Source" (noreq)) 2)
   (copyfiles (prompt "Install Source.")
    (source "Tracks&Fields/Source")
    (dest (tackon @default-dest "Source"))
    (all)
    (optional fail force)
    (confirm)
    (help @copyfiles-help)
   )
  )

; Make Sysex directory.
;------------------

  (working "Checking for Sysex.")
  (makedir (tackon @default-dest "Sysex"))
  (if (= (exists "Tracks&Fields/Sysex" (noreq)) 2)
   (copyfiles (prompt "Install Sysex.")
    (source "Tracks&Fields/Sysex")
    (dest (tackon @default-dest "Sysex"))
    (all)
    (optional fail force)
    (confirm)
    (help @copyfiles-help)
   )
  )
  

; Copy libs to LIBS:
;------------------------

  (copyfiles (prompt "Install Tracks&Fields libraries")
   (source "Tracks&Fields/Libs")
   (dest "LIBS:")
   (all)
   (optional fail force)
   (confirm)
   (help @copyfiles-help)
  )


; Make assign in user-startup
;----------------------------

  (startup "Tracks&Fields" (prompt "Making assign for Tracks&Fields in user-startup.")
   (command "Assign TF: " (expandpath (@default-dest)))
   (help @startup-help)
  )

  (makeassign "TF" @default-dest)
  (exit "")
