;
; $PROJECT: WBStartup+
;
; (C) Copyright 1995 John Hughes.  All Rights Reserved.
;


(
  (working "Installing WBStartup+")

  (message "\n\nWBStartup+ and WBStartup+Prefs\n\nare Postcardware.\n\nIf you use either of these programs, please send a postcard of your city or country to:\n\nJohn Hughes\n901 Highview Rd.\nEast Peoria, IL 61611 USA")

  (if (exists "SYS:WBStartup/WBStartup+")
    ( ; UPGRADE PREVIOUS VERSION
      (message "\n\nA previous version of WBStartup+ has been found.  I will upgrade your version.")
    )
    ( ; INSTALL FOR THE FIRST TIME
      ; Moving the WBStartup files safely
      (
        (rename "SYS:WBStartup" "SYS:WBStartup.temp")
        (makedir "SYS:WBStartup")
        (rename "SYS:WBStartup.temp" "SYS:WBStartup/WBStartup (Enabled)")
      )

      ; Creating Disabled Directory
      (makedir "SYS:WBStartup/WBStartup (Disabled)")
    )
  )

      ; Copying icon
      (copyfiles
        (prompt "Copying the Enabled icon")
        (source "icons/Enabled_Icon.info")
        (dest "SYS:WBStartup")
        (newname "WBStartup (Enabled).info")
      )

      ; Copying icon
      (copyfiles
        (prompt "Copying the Disabled icon")
        (source "icons/Disabled_Icon.info")
        (dest "SYS:WBStartup")
        (newname "WBStartup (Disabled).info")
      )

      ; Copy WBStartup+
      (if (< (/ (getversion) 65536) 39)  ;if this is OS2.x
        ; Copy WBStartup+ for OS2.x
        (copyfiles
          (prompt "Copying the WBStartup+ Executable for OS2.x")
          (help @copyfiles-help)
          (source "OS2.x/WBStartup+")
          (dest "SYS:WBStartup")
          (infos)
        )
        (
          ; else, copy WBStartup+ and WBStartup+Prefs for OS3.x users

          ; Copy WBStartup+ for OS3.x
          (copyfiles
            (prompt "Copying the WBStartup+ Executable for OS3.x")
            (help @copyfiles-help)
            (source "OS3.x/WBStartup+")
            (dest "SYS:WBStartup")
            (infos)
          )
          ; Copy WBStartup+Prefs for OS3.x users
          (copyfiles
            (prompt "Copying the WBStartup+Prefs Executable for OS3.x")
            (help @copyfiles-help)
            (source "OS3.x/WBStartup+Prefs")
            (dest "SYS:Prefs")
            (confirm)
            (infos)
          )
        )
      )

      ;****************************************************************
      ;Install language Catalogs

      (set def-lang 0)

      (complete 60) (working #lang-install-text)

      (set lang
        (askoptions
      	(prompt #lang-which-text)
      	(help #lang-which-help)
      	(choices "Deutsch" "Franais" "Italiano" "Norsk" "Svenska")
      	(default def-lang)
      ))

      (set n 0)

      (while (set language (select n "deutsch" "franais" "italiano" "norsk" "svenska" "") )
      (
      	(if (IN lang n)
      		(copyfiles
            (source (cat "Locale/" language ".catalog" ))
      			(dest (cat "LOCALE:catalogs/" language ))
      			(newname "WBStartup+Prefs.catalog")
      		)
      	)
      	(set n (+ n 1))
      ))

      ;****************************************************************

      ; install AmigaGuide file
      (copyfiles
        (prompt "Copying AmigaGuide file")
        (help @copyfiles-help)
        (source "WBStartup+.guide")
        (dest "AmigaGuide:")
        (confirm)
      )

      ; install WBStart-Handler to L:
      (copylib
        (prompt "Copying AmigaGuide file")
        (help @copylib-help)
        (source "L/WBStart-Handler")
        (dest "L:")
      )

	(set @default-dest "SYS:WBStartup")
)
