(welcome "Welcome to the MCDPlayer installation utility.")

(set @default-dest
   (askdir
      (prompt "Where would you like MCDP to be installed?")
      (help "Choose a directory to install the program ind its other\nfiles into.")
      (default "SYS:Utilities/")
   )
)

(if
   (askbool
      (prompt "Should I create a new directory in\n" @default-dest "?")
      (help "Yes = install MCDP here.\nNo  = install MCDP in here/MCDP")
      (default 0)
   )
   (set @default-dest
      (tackon @default-dest "MCDP/")
   )
)

(set FileThere
   (exists @default-dest
      (noreq)
   )
)

(if
   (= FileThere 1)
   (abort @default-dest "\nis a file. I can't install MCDP here.")
)

(if
   (= FileThere 0)
   (makedir @default-dest)
)

(set DoPatch 0)

(copyfiles
   (prompt "Copying player...")
   (source "")
   (choices "MCDPlay" "MCDPlay.info")
   (dest @default-dest)
)

(copyfiles
   (prompt "Installing fonts...")
   (source "Fonts/")
   (all)
   (dest "FONTS:")
)

(if
   (askbool
      (prompt "Do you want the CD definitions installed?")
      (help "MCDP comes with many CD listings. This section installs them.")
      (default 1)
   )
   (
      (message "Installing disc descriptions...")
      (run "lha x Disks.lha " @default-dest)
   )
   (if (= 0 (exists (tackon @default-dest "Disks")))
      (makedir (tackon @default-dest "Disks"))
   )
)

(tooltype
   (prompt "Setting the default disc directory...")
   (dest
      (tackon @default-dest "MCDPlay")
   )
   (settooltype "SongPath"
      (tackon @default-dest "Disks/")
   )
)

(if 
  (askbool
     (prompt "Do you want to install the default control panel images?")
     (help "MCDP comes with one custom control panel")
     (default 1)
  )
  (copyfiles
     (prompt "Install the control panel images?")
     (source "")
     (help "Gimme a dir")
     (choices "Panel.brs" "Paneld.brs")
     (dest @default-dest)
  )
)

(if
  (askbool
    (prompt "Do you want to add comments to existing CD definitions?")
    (help "I can add the CD title as a comment to each definition you have.")
    (default 1)
  )
  (
    (message "Adding comments to disc IDs...")
    (run (cat "AddCDComment " (tackon @default-dest "Disks/")))
  )
)

(tooltype
   (dest (tackon @default-dest "MCDPlay"))
   (settooltype "FONTNAME"
      (select 
         (askchoice
            (prompt "Which font do you want to use?")
            (help "Choose the default font.")
            (default 0)
            (choices
               "Standard"
               "Dot"
               "LCD"
            )
         )
         "MCDP_STD.font"
         "MCDP_DOT.font"
         "MCDP_LCD.font"
      )
   )
)

(tooltype
   (dest (tackon @default-dest "MCDPlay"))
   (settooltype "XPOS" "0")
   (settooltype "YPOS" "14")
)

(copyfiles
   (prompt "Where do you want the documentation installed?")
   (help "Gimme a dir")
   (source "")
   (choices "MCDPlayer.Doc" "MCDP_ARexx.doc")
   (dest @default-dest)
   (infos)
   (confirm)
)
