; Installation script for CommandList

(if (< (/ (getversion) 65536) 37)
  (
    (abort "You must have Kickstart 2.04 or higher installed to use CommandList!")
  )
)

(complete 0)

(set destdir
   (askdir
      (prompt "Where do you want to install CommandList?")
      (help "")
      (default "SYS:WBStartup")
   )
)

(set @default-dest destdir)

(copyfiles
   (source "CommandList")
   (dest destdir)
)

(complete 33)

(set iconname (tackon destdir "CommandList.info"))
(set ex (exists iconname (noreq)))
(debug iconname)

(if (= ex 0)
   (copyfiles
      (source "CommandList.info")
      (dest destdir)
   )
)

(complete 66)

(if (exists "SYS:Locale")
  (
    (if (exists "LOCALE:")
      (
         (set lang
          (askoptions
            (prompt "Which languages do you want to install?")
            (help "")
            (choices
              "Deutsch"
              "English"
              "Svenska")
            (default 0)
          )
         )

        (set n 0)
        (while (set language
            (select n
              "deutsch"
              "english"
              "svenska"
              "")
            )
          (
            (if (IN lang n)
              (
                (if (<> "english" language)
                  (
                    (makedir (tackon "LOCALE:Catalogs" language))
                    (copyfiles
                      (source (tackon (tackon "Catalogs" language) "CommandList.catalog"))
                      (dest (tackon "LOCALE:Catalogs/" language)))
                  )
                )
              )
            )
            (set n (+ n 1))
          )
        )
      )
    )
  )
)

(complete 100)
(exit)
