;-----------------------------------------------------
; Installer script for the Electrics Digital Designer
;-----------------------------------------------------

(set DefaultDestination "RAM:Electrics")
(set FileSource         ""             )
(set ExamplesDirectory  "Examples"     )
(set LibraryDirectory   "libs"         )

(complete 0)

(
  set FileDestination
  (
    askdir (default DefaultDestination)
           (prompt "Electrics program files destination.")
           (help "Destination Drawer\n\n"
                 "The installer will copy all Electrics files into the "
                 "selected Drawer (which may refer to a Volume or a Directory).  "
                 "A new Drawer can be created, or an existing one can be "
                 "chosen from the list.")
  )
)

(
  if ((exists FileDestination (noreq)) 0)
  (
    (
      makedir FileDestination 
            (prompt (cat "Creating the directory " FileDestination))
            (help @makedir-help)
            (confirm)
            (infos)
    )
  )
)

(complete 5)

(
  copyfiles (source (cat FileSource "Schematic"))
            (dest FileDestination)
            (help @copyfiles-help)
            (infos)
)

(complete 30)

(
  copyfiles (source (cat FileSource "Simulator"))
            (dest FileDestination)
            (help @copyfiles-help)
            (infos)
)

(complete 40)

(
  copyfiles (source (cat FileSource "Viewer"))
            (dest FileDestination)
            (help @copyfiles-help)
            (infos)
)

(complete 50)

(
  copyfiles (source (cat FileSource "Electrics.Guide"))
            (dest FileDestination)
            (help @copyfiles-help)
            (infos)
)

(complete 60)

(
  makedir (tackon FileDestination ExamplesDirectory)
          (prompt "Creating directory for design Examples.")
          (help @makedir-help)
          (infos)
)

(complete 65)

(
  copyfiles (source (tackon FileSource ExamplesDirectory))
            (dest (tackon FileDestination ExamplesDirectory))
            (pattern "#?")
            (help @copyfiles-help)
            (infos)
)

(complete 95)

(
  copylib (source (tackon (tackon FileSource LibraryDirectory) "reqtools.library"))
          (dest "LIBS:")
          (prompt "Electrics requires the ReqTools library.")
          (help "ReqTools Library\n\n"
                "Electrics requires the ReqTools library in order to run.  "
                "The file 'reqtools.library will be copied to the LIBS:"
                "directory if it is not already present.  If an older version"
                "is present, it will be replaced with a newer version.")
          (confirm)  
)

(complete 100)

(set @default-dest FileDestination)

(exit)
