(message "\n\n\nKRSNAke v1.8\n\nŠ 1995 by Psilocybe Software\n\n"
         "This program is released under the GNU General Public License. "
         "See the accompanying file 'COPYING' for details.")

(message "\nWARNING:\n\nThis is a BETA release of KRSNAke; while it has proven "
         "stable enough for release, it is expected that some bugs still remain. "
         "If you encounter any, please notify the author at e-mail address "
         "stokke@telepost.no. The author naturally takes no responsibility for "
         "damage or loss of data caused by bugs in KRSNAke. That said, it isn't "
         "like KRSNAke will fry your CPU or anything. This is a STABLE beta "
         "release...\n\nGood luck!")

(welcome "This program is released under the GNU General Public License. "
         "See the accompanying file 'COPYING' for details.\n")

(set @default-dest (tackon
                        (askdir
                            (prompt "Select a location for the KRSNAke directory")
                            (help @askdir-help)
                            (default "Work:")
                        ) "KRSNAke")
)

(if (exists @default-dest) (
    (if (= @user-level 0) (set delete-old 1)
        (set delete-old (askbool (prompt "\n\n\n\nA version of KRSNAke has already been installed in "
                 "this directory. Do you wish to delete this before commencing "
                 "with the installation?\n\nWARNING: Make sure there is nothing "
                 "in your old KRSNAke directory you need if you choose to delete "
                 "it!") (help @askbool-help))
        )
    )
    (if (<> delete-old 0) (run ("c:delete %s %s.info force quiet all" @default-dest @default-dest)))
))

(makedir @default-dest (infos))

(copyfiles (source "KRSNAke")
           (dest @default-dest)
           (infos)
           (prompt "Copying KRSNAke executable...")
           (help @copyfiles-help)
)
(copyfiles (source "KRSNAkePrefs")
           (dest @default-dest)
           (infos)
           (prompt "Copying KRSNAke Prefs Editor...")
           (help @copyfiles-help)
)

(copylib (source "Libs/krsnake.library")
         (dest "LIBS:")
         (prompt "Copying libraries...")
         (help @copylib-help)
)
(copylib (source "Libs/gtlayout.library")
         (dest "LIBS:")
         (prompt "Copying libraries...")
         (help @copylib-help)
)
(copylib (source "Libs/reqtools.library")
         (dest "LIBS:")
         (prompt "Copying libraries...")
         (help @copylib-help)
)
(copylib (source "Libs/medplayer.library")
         (dest "LIBS:")
         (prompt "Copying libraries...")
         (help @copylib-help)
)
(copylib (source "Libs/player61.library")
         (dest "LIBS:")
         (prompt "Copying libraries...")
         (help @copylib-help)
)

(makedir (tackon @default-dest "Clients"))

(copyfiles (source "Clients")
           (dest (tackon @default-dest "Clients"))
           (infos)
           (all)
           (confirm "average")
           (prompt "Copying KRSNAke clients...")
           (help (cat "  Action Replay\n\nThis client records your games and "
                      "offers you the possibility of replaying them at any speed.\n\n"
                      "  Hall Of Fame\n\nThis client provides you with a high score "
                      "table.\n\n" @copyfiles-help))
)

(copyfiles (source "Rexx")
           (dest (tackon @default-dest "Rexx"))
           (infos)
           (all)
           (confirm "average")
           (prompt "Copying ARexx scripts...")
           (help @copyfiles-help)
)

(if (exists "Graphics")
    (copyfiles (source "Graphics")
           (dest (tackon @default-dest "Graphics"))
           (infos)
           (all)
           (confirm "average")
           (prompt "Copying graphics...")
           (help @copyfiles-help)
    )
)

(if (exists "Sound")
    (copyfiles (source "Sound")
           (dest (tackon @default-dest "Sound"))
           (infos)
           (all)
           (confirm "average")
           (prompt "Copying sound samples...")
           (help @copyfiles-help)
    )
)

(if (<> user-level "novice")
    (if (askbool (prompt "\n\n\n\n\nDo you want to install the documentation?")
                 (help @askbool-help))
        (
            (makedir (tackon @default-dest "Docs"))
            (copyfiles (source "Docs")
                       (dest (tackon @default-dest "Docs"))
                       (infos)
                       (all)
                       (confirm "average")
                       (prompt "Copying documentation...")
                       (help @copyfiles-help)
            )
        )
    )
)

(if (<> user-level "novice")
    (if (askbool (prompt "\n\n\n\n\nDo you want to install the source code (in Amiga-E; Hail Wouter!) and developer information?")
                 (help @askbool-help))
        (
            (makedir (tackon @default-dest "Src"))
            (copyfiles (source "Src")
                       (dest (tackon @default-dest "Src"))
                       (infos)
                       (all)
                       (prompt "Copying source code...")
                       (help @copyfiles-help)
            )
        )
    )
)


