; IconAdder Installer Script

(complete 0)

(set target
   (askdir
      (prompt "Select the destination for IconAdder.")
      (help @askdir-help)
      (default "SYS:")
      (newpath)
   )
)

(complete 20 )

(set target (tackon target "IconAdder" ) )

(makedir target
   (infos)
)

(set @default-dest target)

(copyfiles
   (prompt "Choose which files to install.")
   (help @copymain-help)
   (source "")
   (dest target)
   (pattern "IconAdder#?" )
   (confirm)
)

(complete 50)

(set ask 0)
(if (> (run "Version >Env:WhatIsVers.Tmp WhatIs.Library") 0)
   (
      (set whatisversion "None")
      (set ask 1)
   )
   (
      (set whatisversion
         (substr (getenv "WhatIsVers.Tmp") 15 3 )
      )
      (set vers whatisversion)
      (if (= vers "3.7")
         (set ask 0)
         (set ask 1)
      )
   )
)

(if (= ask 1)
   (set installwhatis
      (askbool
         (prompt "Copying WhatIs.Library...\n\n"
                 "Version to install: 3.7\n"
                 "Version currently installed: "
                 whatisversion
                 "\n\n"
                 "Destination Drawer to Copy to:\n"
                 "LIBS:\n")
         (help @copylib-help)
         (choices "Proceed with Copy" "Skip This Part")
      )
   )
   (set installwhatis 0)
)

(if (exists "Env:WhatIsVers.Tmp")
   (delete "Env:WhatIsVers.Tmp")
)

(if installwhatis
   (copyfiles
      (source "Libs/WhatIs.Library")
      (dest "LIBS:")
   )
)

(complete 60)

(copylib

   (prompt "Copying ReqTools.Library...")
   (help @copylib-help)

   (source "Libs/ReqTools.Library")
   (dest "LIBS:")
   (confirm)
)

(complete 70)

(if (= @user-level 0 )
   (set installicons 1)
   (set installicons
      (askbool
         (prompt "Do you wish to install the icon examples?")
         (help @askbool-help)
      )
   )
)

(if installicons
   (copyfiles
      (prompt "Choose icons to install to ENV:...")
      (help @copyicons-help)
      (files)
      (source "Icons/")
      (dest "ENV:Sys/")
      (pattern "Def_#?.info")
      (confirm)
   )
)

(complete 80)

(if installicons
   (copyfiles
      (prompt "Choose icons to install to ENVARC:...")
      (help @copyfiles-help)
      (files)
      (source "Icons/")
      (dest "ENVARC:Sys/")
      (pattern "Def_#?.info")
      (confirm)
   )
)

(complete 90)

(if (exists "S:FileTypes")
   (if (= @user-level 0)
      (set installfiletypes 1)
      (set installfiletypes
         (askbool
            (prompt "Do you wish to install a new 'FileTypes' file?\n"
                    "You already have one installed.\n" )
            (help @askbool-help)
         )
      )
   )
)

(complete 95)

(set filetypeschoice 0)

(if installfiletypes
   (
      (set filetypeschoice
         (askchoice
            (prompt "Choose which 'FileTypes' to install...")
            (help @askchoice-help)
            (choices "Standard FileTypes" "Modified FileTypes")
         )
      )
      (if (= filetypeschoice 0)
         (copyfiles
            (source "S/")
            (dest "S:")
            (choices "FileTypes")
         )
      )
      (if (= filetypeschoice 1)
         (copyfiles
            (newname "FileTypes")
            (source "S/FileTypes_IconAdder")
            (dest "S:")
         )
      )
   )
)

(complete 100)
