;  *** ARTM installation scipt ***

(welcome "Welcome to the ARTM installation!")

(
        ;get destination dir for ARTM executable
        (set mydest
                (askdir
                        (prompt "Select the directory where you want to put the ARTM executable.")
                        (help   "The directory where you store the executable "
                                "should be easily accessible via WorkBench or CLI/Shell.\n\n"
                                @askfile-help
                        )
                        (default "C:")
                        (disk)
                )
        )

        (set @default-dest mydest)

        (set mmdest (tackon mydest "ARTM"))

        (
                (if (= 1 (exists mmdest))
                        (
                                (if (= 0

                                        (askbool
                                                (prompt "You have already installed ARTM. Do you wish to overwrite it?\n\n")
                                                (help @askbool-help)
                                                (default 1)
                                                (choices "Continue" "Abort")
                                        ))

                                (abort "Okay, I didn't overwrite the executable.")
                                )

                        )

                )
        )

        (copyfiles
                (prompt ("Copying ARTM executable to %s." mydest))
                (help @copyfiles-help)
                (source "ARTM")
                (dest mydest)
                (infos)
        )

)


(
        ;Copy Docs

        (if
                (set qval
                        (askoptions
                                (prompt "Please choose which docs you want to have installed! "
                                        "(Or choose none to have no docs installed!)")
                                (choices
                                        "English Docs"
                                        "German Docs"
                                )
                                (default 3)
                                (help
                                        "Not installing the docs is unwise because you could have "
                                        "questions while using ARTM. Choosing the "
                                        "documentation in your favourite language is sufficient.\n\n"
                                        @askoptions-help
                                )
                        )
                )

                (
                        (set docsdest
                                (askdir
                                        (prompt "Select the directory where you want to put the docs.")
                                        (help
                                                "You may store the docs where you usually store docs or "
                                                "in the directory where ARTM resides in.\n\n"
                                                @askfile-help
                                        )
                                        (default mydest)
                                )
                        )

                        (if (IN qval 0)
                                (copyfiles
                                        (prompt ("Copying english docs to %s." docsdest))
                                        (help @copyfiles-help)
                                        (source "english.doc/ARTM.doc")
                                        (dest docsdest)
                                        (infos)
                                )
                        )

                        (if (IN qval 1)
                                (copyfiles
                                        (prompt ("Copying german docs to %s." docsdest))
                                        (help @copyfiles-help)
                                        (source "german.doc/ARTM.dok")
                                        (dest docsdest)
                                        (infos)
                                )
                        )
                )
        )
)

(
        ;install LOCALEs

        (set guidedir "LOCALE:HELP/")

        (if (= 2 (exists "LOCALE:HELP/" (noreq)))
                (if
                        (set qval
                                (askoptions
                                        (prompt "Please choose which Guide you want to have "
                                                "installed! "
                                                "(Or choose none to have no locale installed!)")
                                        (choices
                                                "Deutsch (german)"
                                                "English (english)"
                                        )

                                        (default 7)
                                        (help
                                                "It is sufficient to install the locale(s) of the language(s) "
                                                "that you specified as 'preferred' in the locale-preferences "
                                                "editor. \n\n"
                                                @askoptions-help
                                        )
                                )
                        )
                (
                        (if (IN qval 0)
                                (copyfiles
                                        (prompt ("Copying german guide to %s." guidedir))
                                        (help @copyfiles-help)
                                        (source "german.doc/ARTM.guide")
                                        (dest guidedir)
                                        (infos)
                                )
                        )
                        (if (IN qval 1)
                                (copyfiles
                                        (prompt ("Copying english guide to %s." guidedir))
                                        (help @copyfiles-help)
                                        (source "english.doc/ARTM.guide")
                                        (dest guidedir)
                                        (infos)
                                )
                        )

                )

                )
        )
)

