;  *** MuchMore installation scipt ***

(welcome "Welcome to the MuchMore installation!")

(
        ;get destination dir for MuchMore-executable
        (set mydest
                (askdir
                        (prompt "Select the directory where you want to put the MuchMore 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 "MuchMore"))

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

                                        (askbool
                                                (prompt "You have already installed MuchMore. 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 MuchMore executable to %s." mydest))
                (help @copyfiles-help)
                (source "MuchMore")
                (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 MuchMore. 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 MuchMore resides in.\n\n"
                                                @askfile-help
                                        )
                                        (default mydest)
                                )
                        )

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

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

(
        ;install LOCALEs

        (set catdir "LOCALE:catalogs")

        (if (= 2 (exists "LOCALE:" (noreq)))
                (if
                        (set qval
                                (askoptions
                                        (prompt "Please choose which catalogs you want to have "
                                                "installed! "
                                                "(Or choose none to have no catalogs installed!)")
                                        (choices
                                                "Deutsch (german)"
                                                "Italiano (italian)"
                                                "Svenska (swedish)"
                                        )

                                        (default 1)
                                        (help
                                                "It is sufficient to install the catalog(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 catalog to %s." (tackon catdir "deutsch")))
                                        (help @copyfiles-help)
                                        (source "Catalogs/deutsch/muchmore.catalog")
                                        (dest (tackon catdir "deutsch"))
                                        (infos)
                                )
                        )
                        (if (IN qval 1)
                                (copyfiles
                                        (prompt ("Copying italian catalog to %s." (tackon catdir "italiano")))
                                        (help @copyfiles-help)
                                        (source "Catalogs/italiano/muchmore.catalog")
                                        (dest (tackon catdir "italiano"))
                                        (infos)
                                )
                        )
                        (if (IN qval 2)
                                (copyfiles
                                        (prompt ("Copying swedish catalog to %s." (tackon catdir "svenska")))
                                        (help @copyfiles-help)
                                        (source "Catalogs/deutsch/muchmore.catalog")
                                        (dest (tackon catdir "svenska"))
                                        (infos)
                                )
                        )

                )

                )
        )
)

