(set @default-dest "FAME:")
(set @app-name "5D-FileId")

(set FAMEPath
  (askdir
    (prompt "Where is your FAME directory located?")
    (help "You have to specify where your FAME is located!")
    (default @default-dest)
  )
)

(set InstallFileId
  (askbool
    (prompt "5D-FileId will be installed into \n\n"
            (FAMEPath))
    (help "5D-FileId will be installed into '"
          (tackon (FAMEPath) "Doors/5D/5D-FileId")
          "'.  If that directory does not exist, it will be created."
          "  To proceed press ok, else press abort installation.")
    (default 1)
  )
)

(if (= InstallFileId 1)
(

  (set InstallFileId_Strip
    (askbool
      (prompt "Do you want to have the 5D-FileId.strip (strip lines) installed into '"
              (tackon (FAMEPath) "Doors/5D/5D-FileId/")
              "'?\n\nIt is needed for the background checking!"
      )
      (help "The 5D-FileId.strip (strip lines) will be installed into '"
            (tackon (FAMEPath) "Doors/5D/5D-FileId/")
            "'. If that directory does not exist, it will be created. "
            "To proceed press ok, else press abort installation.")
      (default 1)
    )
  )

  (set InstallGuide
    (askbool
      (prompt "Do you want to have 5D-FileId.guide installed into '"
              (tackon (FAMEPath) "Doors/5D/5D-FileId")
              "'?")
      (help "5D-FileId.guide will be installed into '"
            (tackon (FAMEPath) "Doors/5D/5D-FileId")
            "'. To proceed press ok, else press abort installation.")
      (default 1)
    )
  )

  (set InstallFileId_BG
    (askbool
      (prompt "Do you want to have the 5D-FileId (CLI-Version) installed into '"
              (tackon (FAMEPath) "FileCheckers/FILEIDENT")
              "'?\n\nIt is needed for the background checking!"
      )
      (help "The 5D-FileId (CLI-Version) will be installed into '"
            (tackon (FAMEPath) "FileCheckers/FILEIDENT")
            "'. If that directory does not exist, it will be created. "
            "To proceed press ok, else press abort installation.")
      (default 1)
    )
  )

  (set InstallSent
    (askbool
      (prompt "Do you want to have the 'SENT' command installed into '"
              (tackon (FAMEPath) "Settings/Doors/BBSCMD")
              "'?"
      )
      (help "The 'SENT' command will be installed into '"
            (tackon (FAMEPath) "Settings/Doors/BBSCMD")
            "'. If that directory does not exist, it will be created. "
            "To proceed press ok, else press abort installation.")
      (default 1)
    )
  )

  (set InstallFileIdent
    (askbool
      (prompt "Do you want to have the 'FILEIDENT' command installed into '"
              (tackon (FAMEPath) "Settings/Doors/SYSCMD")
              "'?"
      )
      (help "The 'SENT' command will be installed into '"
            (tackon (FAMEPath) "Settings/Doors/SYSCMD")
            "'. If that directory does not exist, it will be created. "
            "To proceed press ok, else press abort installation.")
      (default 1)
    )
  )

  (set InstallEnvVariable
    (askbool
      (prompt "Do you want to set the environment variable "
              "'LOCATION.5D-FileId' to 'FAME:Doors/5D/5D-FileId/5D-FileId' in the 'FAMEStart.bat'? "
              "If not then you MUST do this at every new system start manually with\n\n"
              "SetEnv LOCATION.5D-FileId FAME:Doors/5D/5D-FileId/5D-FileId"
      )
      (help "The 'LOCATION.5D-FileId' will be installed into "
            "FAMEStart.bat. "
            "To proceed press ok, else press abort installation.")
      (default 1)
    )
  )


  (if (not (exists (tackon (FAMEPath) "Doors")))
   (makedir (tackon (FAMEPath) "Doors") (infos))
  )
  (if (not (exists (tackon (FAMEPath) "Doors/5D")))
   (makedir (tackon (FAMEPath) "Doors/5D") (infos))
  )
  (if (not (exists (tackon (FAMEPath) "Doors/5D/5D-FileId")))
   (makedir (tackon (FAMEPath) "Doors/5D/5D-FileId") (infos))
  )
  (copyfiles
    (source "Doors/5D/5D-FileId/5D-FileId")
    (dest (tackon (FAMEPath) "Doors/5D/5D-FileId"))
    (all)
    (infos)
  )

  (if (= InstallFileId_Strip 1)
  (
    (copyfiles
      (source "Doors/5D/5D-FileId/5D-FileId.strip")
      (dest (tackon (FAMEPath) "Doors/5D/5D-FileId.strip"))
      (all)
      (infos)
    )
  )
  )
  (if (= InstallGuide 1)
  (
    (copyfiles
      (source "Doors/5D/5D-FileId/5D-FileId.guide")
      (dest (tackon (FAMEPath) "Doors/5D/5D-FileId"))
      (all)
      (infos)
    )
  )
  )
  (if (= InstallFileId_BG 1)
  (
     (if (not (exists (tackon (FAMEPath) "FileCheckers")))
     (makedir (tackon (FAMEPath) "FileCheckers"))
    )

    (if (not (exists (tackon (FAMEPath) "FileCheckers/FILEIDENT")))
     (makedir (tackon (FAMEPath) "FileCheckers/FILEIDENT"))
    )

    (copyfiles
      (source "FileCheckers/FILEIDENT/5D-FileId")
      (dest (tackon (FAMEPath) "FileCheckers/FILEIDENT"))
      (all)
      (infos)
    )
  )
  )

  (if (= InstallSent 1)
  (
     (if (not (exists (tackon (FAMEPath) "Settings")))
     (makedir (tackon (FAMEPath) "Settings"))
    )

    (if (not (exists (tackon (FAMEPath) "Settings/Doors")))
     (makedir (tackon (FAMEPath) "Settings/Doors"))
    )

    (if (not (exists (tackon (FAMEPath) "Settings/Doors/BBSCMD")))
     (makedir (tackon (FAMEPath) "Settings/Doors/BBSCMD"))
    )

    (copyfiles
      (source "Settings/Doors/BBSCMD/SENT")
      (dest (tackon (FAMEPath) "Settings/Doors/BBSCMD"))
      (all)
      (infos)
    )
  )
  )

  (if (= InstallFileIdent 1)
  (
     (if (not (exists (tackon (FAMEPath) "Settings")))
     (makedir (tackon (FAMEPath) "Settings"))
    )

    (if (not (exists (tackon (FAMEPath) "Settings/Doors")))
     (makedir (tackon (FAMEPath) "Settings/Doors"))
    )

    (if (not (exists (tackon (FAMEPath) "Settings/Doors/SYSCMD")))
     (makedir (tackon (FAMEPath) "Settings/Doors/SYSCMD"))
    )

    (copyfiles
      (source "Settings/Doors/SYSCMD/FILEIDENT")
      (dest (tackon (FAMEPath) "Settings/Doors/SYSCMD"))
      (all)
      (infos)
    )
  )
  )

  (if (= InstallEnvVariable 1)
  (
    (if (not (exists "ENV:LOCATION.5D-FileId"))
      (Run "C:Echo >>" (tackon (FAMEPath) "Settings/FAMEStart.bat") " SetEnv LOCATION.5D-FileId FAME:Doors/5D/5D-FileId/5D-FileId"
      )
    )
  )
  )

)
)

