;
; DMS2HD installer Script - by Software Failure/Airsoft
;
; if there are any problems, email me: softwarefailure@dame.de
;

(message (cat "\n\nDMS2HD V1.0 \n\n(c) 1997 by Andreas Falkenhahn\n\n\n"
              "This script installs DMS2HD to your\n"
              "harddisk and adds an assign to your\n"
              "S:User-startup. All operations can be\n"
              "skipped!"
         )
)

(welcome)

(set #whereinstall "Copying file DMS2HD to C:")
(set #whereinstall1 "Where to create the directory DMS2HD?")
(set #whereinstall2 "Select destination for the documentation") 

(set #whereinstall_help "No help available")

(if (not (exists "C:DMS"))
   (abort "Cannot find C:DMS. Please copy your DMS executable to C:. Path can be specified by the user in later versions! Please be patient!")
)
   
(set name
    (askdir 
           (prompt #whereinstall1)
           (help "Please select a valid path where the datafiles can be copied to!")
           (default "SYS:")
    )
)

(copyfiles
   (source "/DMS2HD.info")
   (dest   name)
   (nogauge)
)

(makeassign "aj" name)

(makedir "aj:DMS2HD")

(makeassign "ag" "aj:DMS2HD")

(makedir "ag:dat")

(working "\n\nCopying datafiles...")

(copyfiles
   (source "dat/")
   (dest "ag:dat")
   (all)
   (nogauge)
)

(copyfiles
  (prompt #whereinstall)
  (help "Select path where to install the main executable. Recommend is C:")
  (source "DMS2HD")
  (dest "C:")
  (confirm)
)

(working "\n\nPlease wait...")

(set dest2
     (askdir
           (prompt #whereinstall2)
           (help "Select a path where to copy the documentation. Recommend is HELP:")
           (default "Help:")
     )
)

(MakeAssign "airsoft2" dest2)

(copyfiles (source "DMS2HD.guide") (dest "airsoft2:"))
(copyfiles (source "DMS2HD.guide.info") (dest "airsoft2:"))

(set sstr (substr name (- (strlen name) 1) 1))
(if (or (= sstr "/") (= sstr ":")) (set dname (cat name "DMS2HD")) (set dname (cat name "/DMS2HD")))

(set sstr (substr dname (- (strlen dname) 1) 1))
(if (or (= sstr "/") (= sstr ":")) (set diname (cat dname "dat")) (set diname (cat dname "/dat")))

(startup (prompt #assign) (help "No help")

          "DMS2HD"
          (command (cat "\n"
              "Assign DDAT: " diname
          )
))

(message (cat "\n\nDMS2HD was successfully installed!\n\n"
              "Enjoy the program and register!"
))

(exit (quiet))
