; $VER: InterfaceEditor-Install 1.5 (22.2.96)

(complete 0)

(set InstallDir
   (askdir
      (prompt "Where do you want to install Interface Editor?"
              " (the 'IEditor' directory will be created there)")
      (help @askdir-help)
      (default "Work:")
   )
)

(Set DestDir 
   (tackon InstallDir "IEditor")
)

(Set DevIEDir
   (tackon DestDir "Developer/Include")
)

(Set DocsDir
   (tackon InstallDir "Docs")
)

(Set IncludeDir 
   (tackon DestDir "Include")
)

(Set LocaleDir
   (tackon DestDir "Locale")
)

(set @default-dest 
   DestDir
)

(makedir
   DestDir 
   (infos)
)

(complete 10)

(if (<= (/ (getversion) 65536) 38)
   (set Kick2 1)
   (set Kick2 0)
)

(copyfiles
  (source "")
  (dest DestDir)
  (pattern "~(KeyFile|Install|Locale|Include|Libs|PROGRAM.ISN)#?")
  (infos)
  (noposition)
)

(if (exists "KeyFile/IEditor.key")
  (copyfiles
     (source "KeyFile/IEditor.key")
     (dest DestDir)
  )
)

(if Kick2
   (tooltype
      (dest (tackon DocsDir "InterfaceEditor_ENG.guide"))
      (setdefaulttool "AmigaGuide")
      (dest (tackon DocsDir "InterfaceEditor_ITA.guide"))
      (setdefaulttool "AmigaGuide")
   )
)

(complete 50)

(makedir
  LocaleDir
  (infos)
)

(copyfiles
  (source "Locale")
  (dest LocaleDir)
  (pattern "IEditor#?.c#?")
)

(complete 60)

(complete 70)

(makedir
  IncludeDir
  (infos)
)

(copyfiles
  (source "Include")
  (dest IncludeDir)
  (all)
  (infos)
  (noposition)
)


(complete 80)

(if (exists "ENV:IEditor/FunctionEd")
  (set DefEd (getenv "IEditor/FunctionEd"))
  (set DefEd "C:Ed %s")
)

(makedir "ENVARC:IEditor")
(makedir "ENV:IEditor")

(set Editor
  (askstring
    (prompt "Setting the IEditor/FunctionEd environment variable. "
            "This is used to launch the editor used by Function.iex.")

    (help "The %s simbol in the string will be replaced with the name "
          "of the file to edit. The editor must not detache itself, "
          "so if you're using editors like CygnusEd, you should add the "
          "option -keepio, or -STICKY, depending on what your editor "
          "requires.")

    (default DefEd)
  )
)

(textfile
  (dest "ENVARC:IEditor/FunctionEd")
  (append Editor)
)

(copyfiles
  (source "ENVARC:IEditor/FunctionEd")
  (dest   "ENV:IEditor")
)

(complete 85)

(startup "IEditor"
  (prompt "Editing your S:User-Startup")
  (help "The Installer will add some assigns needed by "
        "IE or needed to compile the generated source")
  (command (cat "Assign DEV_IE: \"" DevIEDir "\""))
)

(complete 90)

(copyfiles
  (prompt "Copying catalog files")
  (help @copyfiles-help)
  (source "Locale")
  (dest "LOCALE:Catalogs")
  (confirm)
  (choices "english")
)

(complete 100)
