
(complete 0)

(set vernum (getversion ))
(set ver (/ vernum 65536))
(if (> 37 ver)
   ;then
(exit "YoWB 1.0 needs AmigaDOS Release 2.0 or higher : Can't install YoWB" (quiet))
   ;else
(welcome("Welcome to the Install script of YoWB 1.0"))
)

;======================================================= APPLICATION : YoWB 1.0
(
 (set partname "SYS:WbStartup")

  (set Anydir (askdir
        (prompt "Choose the disk or directory where \"YoWB\" will be copied :")
        (help "Use mouse or keyboard to enter the disk or directory where \"YoWB\" should be copied.\n")
        (default partname)
        (disk)
        )
  )
)

(message ("\nAre you sure you want to install YoWB in the %ls Ditectory ?\n" Anydir)
)

(if (= (exists "env:magicwb" (noreq)) 0)
 ; then le fichier n'existe pas
   (
    (copyfiles (source "YoWB") (dest Anydir) (infos))
    (complete 20)
    (working "Copying the Preferences Software...")
    (copyfiles (source "YoPrefs") (dest "SYS:Prefs") (infos))
   )
 ; else on a trouve magicwb
   (
    (copyfiles (source "YoWB") (dest Anydir))
    (copyfiles (source "MagicIcon/YoWB.info") (dest Anydir))
    (complete 20)
    (working "Copying the Preferences Software...")
    (copyfiles (source "YoPrefs") (dest "SYS:Prefs"))
    (copyfiles (source "MagicIcon/YoPrefs.info") (dest "SYS:Prefs"))
   )
); end-if
(complete 20)


(set SoundDir (askdir
        (prompt "Choose the partition or the directory where the sounds will be copied (a new directory will be created) :")
        (help "Use mouse or keyboard to enter the disk or directory where you want to copy the sounds.\n")
        (default AnyDir)
        (disk)
        )
 )
(set OutDir (tackon SoundDir "YoSounds"))
(makedir OutDir)

;======= Copie des sons ==================
(Working "Installing Sounds")
 (foreach "YoSounds" "#?"
    (copyfiles
        (source (tackon "YoSounds" @each-name))
        (dest OutDir)
        (optional nofail)
    )
 )

;======= Copie des sons ==================
(Working "Installing Preferences")
(copyfiles (source "YoWB.Prefs") (dest "ENV:"))
(copyfiles (source "YoWB.Prefs") (dest "ENVARC:"))

(if (= (exists OutDir (noreq)) 2)          ; OutDir est un répertoire existant ?
; then
 (
  (makeassign "YoSounds" OutDir)
     (startup "UIK"
        (prompt ("\nThe \"Assign YoSounds: %ls\" line will be added in your Startup procedure..." OutDir))
        (help "This Assign is required by YoWB for finding its sound files"
              )
        (command ("Assign YoSounds: %ls" OutDir))
     )
 )
)
(complete 25)

(copylib
    (source "decollage.library")
    (dest "libs:")
    (optional nofail)
)

;======================================================= UIK

; Ce script d'installation a besoin d'être dans le même répertoire que
; "uik.library", "UIKPrefs", et un sous-répertoire "UIK" qui contient
; lui-même les objets dans un sous-sous-répertoire "Objects".
; Cette configuration permet aussi à l'utilisateur (si l'application
; est dans le même répertoire que ce script) d'essayer directement
; l'application depuis la disquette sans qu'il soit nécessaire de
; l'installer au préalable.

;------------------------------------ Librairie

(message  "\nNow, the install script will examine if its release of uik.library is higher "
          "than the one installed on your system. In any case, it will set the latest "
          "release on your system."
    (help "UIK is a set of files used by YoWB. This step will install the latest "
          "release of UIK.\n"
          "So, it's necessary to continue the installation if you want use YoWB "
          "without any problem."
          )
)

(copylib
    (source "uik.library")
    (dest "libs:")
    (optional nofail)
)

(complete 30)

;------------------------------------ UIKPrefs

(message  "\nAre you OK to install UIKPrefs in the \"SYS:Prefs\" directory ?\n"
          "\n(type Help for more details)"
    (help "UIKPrefs will allow you to set up the Preferences for UIK, and so, "
          "this application which uses UIK.\n"
          "With UIKPrefs, you can change :\n"
          "- Colors\n"
          "- Fonts\n"
          "- the default screen\n"
          "- The \"Système\" look or the \"UIK\" look \n"
          "The setting of the colors is very important to have a Graphical User Interface very attactive, with a 3D aspect. "
          "If you set a dark grey in the box \"Surligne\", enable the small button which is on its right."
          )
)

(copyfiles (source "UIKPrefs.info") (dest "SYS:Prefs"))
(copylib
    (source "UIKPrefs")
    (dest "SYS:Prefs")
    (optional nofail)
)
(tooltype (dest (tackon "SYS:Prefs" "UIKPrefs")) (noposition) (swapcolors))

(complete 50)

;=============== Choix des couleurs ===========================
(makedir "env:UIK")
(makedir "envarc:UIK")


;------------------------------------ Objets

;---------------------- Création répertoire

(if (= (exists "UIK:" (noreq)) 2)          ; "UIK: est un répertoire existant ?
; then
    (set uikdirname "UIK:")
; else
    (
    (if (= (exists "WORK:" (noreq)) 2)
    ; then
        (set partname "WORK:")
    ; else
        (set partname "SYS:")
    )
    (set uikdir (askdir
        (prompt "Choose the disk or the directory where a sub-directory \"UIK\" will be created :")
        (help "Use mouse or keyboard to enter the disk or directory where you want an \"UIK\" sub-directory to be created.\n"
              "This directory will be used with all the applications using UIK."
              )
        (default partname)
        (disk)
        )
    )
    (set uikdirname (tackon uikdir "UIK"))
    (set uikdir "abcdLSKJDMLS:") ; sécurité
    )
)

(message ("\nAre you OK to install UIK in the %ls Directory ?\n" uikdirname)
          "\nIf the UIK Directory doesn't exist, it will be created."
)

(makedir uikdirname
    (infos)
)

(complete 60)

;---------------------- Copie des objets

(set uikobjdirname (tackon uikdirname "Objects"))

(foreach "UIK/Objects" "UIKObj_#?"
    (copylib
        (source (tackon "UIK/Objects" @each-name))
        (dest uikobjdirname)
        (optional nofail)
    )
)

(complete 90)

;----------------------------------------------  Startup

(if (< (exists "UIK:" (noreq)) 2)          ; "UIK: est un répertoire existant ?
; then
    (
    (makeassign "UIK" uikdirname)

    (startup "UIK"
        (prompt ("\nThe line \"Assign UIK: %ls\" will be added in your user-startup file..." uikdirname))
        (help "This assign is required, because UIK needs to find its files."
              "(parameters, objects, etc...) without worrying how the applications are launched."
              )
        (command ("Assign UIK: %ls" uikdirname))
    )
    )
)

(complete 100)

(exit "Don't Forget to run the Preferences software UIKPrefs to customize YoWB.")

;======================================================= FIN

