;------------------------------------------------------------------------------
;
;   File    :   SongPlayer-Install
;
;   Author  :   Stphane TAVENARD
;
;   (C) Copyright 1996-1996 Stphane TAVENARD
;       All Rights Reserved
;
;   #Rev|   Date   |                      Comment
;   ----|----------|--------------------------------------------------------
;   0   |05/01/1997| Initial revision                                     ST
;
;   ------------------------------------------------------------------------
;
;   SongPlayer Intall script
;
;------------------------------------------------------------------------------

(complete 0)

; Franais
;------------------------------------------------------------------------------
(if (= @language "franais")
(

(set #guide "SongPlayer.fr.Guide" )

(set #destdir
   (cat "Choisisez un repertoire de destination pour SongPlayer.\n"
        "Un Tiroir nomm 'SongPlayer'y sera cr."
    )
)

(set #copying "Copie des fichiers en cours.")

(set #startup_assign
   (cat "Creation de l'assigne de SongPlayer.\n"
        "\n"
        "Un assigne va tre ajout dans votre User-Startup."
   )
)

(set #cpu_choice
   (cat "Indiquez le processeur de votre Amiga\n"
        "\n"
        "La version correspondante de SongPlayer sera choisie."
   )
)

)

; Language is english by default
;------------------------------------------------------------------------------
(

(set #guide "SongPlayer.en.Guide" )

(set #destdir
   (cat "Please select a place for SongPlayer.\n"
        "A drawer called 'SongPlayer' will be created.")
   )
)

(set #copying "Files copy in progress.")

(set #startup_assign
   (cat "Create assign of SongPlayer.\n"
        "\n"
        "An assign will be added to your User-Startup."
   )
)

(set #cpu_choice
   (cat "Select the CPU of your Amiga\n"
        "\n"
        "The corresponding version of SongPlayer will be choosen."
   )
)

)


; Search for old SONGPLAYER directory
;------------------------------------------------------------------------------
(complete 10)

(if (<> (exists "SONGPLAYER:" (noreq)) 0)
(
   (set @default-dest (expandpath "SONGPLAYER:/"))
   (set songplayerdir (tackon @default-dest "SongPlayer"))
))

; Ask for destination directory
;------------------------------------------------------------------------------
(complete 20)

(set @default-dest
   (askdir
      (prompt #destdir)
      (help @askdir-help)
      (default @default-dest)
   )
)

(set @default-dest (expandpath @default-dest))
(set destination (tackon @default-dest "SongPlayer"))

; Create dir if don't exist
;------------------------------------------------------------------------------
(complete 30)

(if (= (exists destination) 0 )
(
   (makedir destination (help @makedir-help))
))


; Copy Main files now
;------------------------------------------------------------------------------
(complete 40)

(copyfiles
   (prompt #copying)
   (source "")
   (files)
   (choices #guide "SongPlayer.info")
   (dest destination)
   (infos)
   (noposition)
   (help @copyfiles-help)
)

; Copy Images files now
;------------------------------------------------------------------------------
(complete 50)

(copyfiles
   (prompt #copying)
   (source "")
   (pattern "Images")
   (dest destination)
   (infos)
   (help @copyfiles-help)
)

; Copy Utilities files now
;------------------------------------------------------------------------------
(complete 60)

(copyfiles
   (prompt #copying)
   (source "")
   (pattern "Utils")
   (dest destination)
   (infos)
   (help @copyfiles-help)
)


; Ask for CPU version
;------------------------------------------------------------------------------
(complete 70)

(set choice
   (askchoice
      (prompt #cpu_choice)
      (choices "68020-30" "68040" "68060")
      (help @askoptions-help)
   )
)

; Copy the selected CPU version of songplayer
;------------------------------------------------------------------------------
(complete 80)

(if (= 0 choice )
(
   (copyfiles
      (source "SongPlayer.020")
      (dest destination)
      (newname "SongPlayer")
      (help @copyfiles-help)
   )
))

(if (= 1 choice )
(
   (copyfiles
      (source "SongPlayer.040")
      (dest destination)
      (newname "SongPlayer")
      (help @copyfiles-help)
   )
))

(if (= 2 choice )
(
   (copyfiles
      (source "SongPlayer.060")
      (dest destination)
      (newname "SongPlayer")
      (help @copyfiles-help)
   )
))

; User-Statup update
;------------------------------------------------------------------------------
(complete 80)

(startup "SongPlayer"
   (prompt #startup_assign)
   (help @startup-help)
   (confirm)
   (command "assign SONGPLAYER: \"" destination "\"\n")
)

; The End
;------------------------------------------------------------------------------
(complete 90)

(run (cat "assign SONGPLAYER: " "\"" destination "\""))

(complete 100)
