; HippoPlayerIR
; $VER: HippoPlayerIR 1.6 (24.04.2023)

; Generated by InstallerGen 1.5!

(complete 0)
(set @app-name "HippoPlayerIR")
(set @default-dest "ram:")
; Welcome screen
(welcome "HippoPlayerIR Installation")

(complete 10)
; Choose installation location
(set #default-dest-installergen-temp
  (askdir
    (prompt "Please choose a location for installing HippoPlayerIR. A drawer called \"HippoPlayerIR\" will be automatically created.")
    (help "Choose where to install HippoPlayerIR using the controls in the Installer window")
    (default @default-dest)
  )
)
(set @default-dest #default-dest-installergen-temp)
(set @default-dest (tackon @default-dest "HippoPlayerIR"))

(complete 20)
; Copy the files (without source)
(copyfiles
  (prompt "Copying files...    ")
  (help @copyfiles-help)
  (infos)
  (source "")
  (dest @default-dest)
  (choices "HippoPlayerIR")
)
(copyfiles
  (prompt "Copying files...    ")
  (help @copyfiles-help)
  (infos)
  (source "")
  (dest @default-dest)
  (choices "HippoPlayerIR.info" "arexx")
)
(copyfiles
  (prompt "Copying files...    ")
  (help @copyfiles-help)
  (infos)
  (source "")
  (dest @default-dest)
  (choices "example_config")
)

(complete 25)
; Check if old HippoPlayerIR.exe exists
(set #exe
  (exists (tackon @default-dest "HippoPlayerIR.exe") (noreq))
)

(complete 26)
; if old exe file exists
(if (> #exe 0)
(

(complete 27)
; Delete old exe file
(delete (tackon @default-dest "HippoPlayerIR.exe")
  (prompt "")
  (help )
  (infos)
  (optional "askuser")
)

)
) ; End If
(complete 28)
; Check if HippoPlayer.config exists
(set #config
  (exists (tackon @default-dest "HippoPlayerIR.config") (noreq))
)

(complete 30)
; if config exists
(if (> #config 0)
(

(complete 30)
; What to do with existing config
(set #options
  (askchoice
    (prompt "HippoPlayerIR.config file found. What should we do with it?")
    (help @askchoice-help)
    (choices "Keep old config file" "Overwrite it with new config file" "Make a backup of old config file and copy new one")
    (default 2)
  )
)
(if (= #options 0) (set #keepit 1) (set #keepit 0))
(if (= #options 1) (set #overwrite 1) (set #overwrite 0))
(if (= #options 2) (set #backup 1) (set #backup 0))

)
) ; End If
(complete 10)
; Check if HippoPlayer.config exists
(set #config
  (exists (tackon @default-dest "HippoPlayerIR.config") (noreq))
)

; if config doesnt exists
(if (= #config 0)
(

(complete 10)
; Copy config to dest
(copyfiles
  (prompt "")
  (help @copyfiles-help)
  (infos)
  (source "")
  (dest @default-dest)
  (choices "HippoPlayerIR.config")
)

)
) ; End If
; if user want to overwrite current config
(if (= #overwrite 1)
(

; Copy new config
(copyfiles
  (prompt "Copy new config config file")
  (help @copyfiles-help)
  (infos)
  (source "")
  (dest @default-dest)
  (choices "HippoPlayerIR.config")
)

)
) ; End If
; if user want to make backup
(if (= #backup 1)
(

; Rename config file
(rename (tackon @default-dest "HippoPlayerIR.config") (tackon @default-dest "HippoPlayerIR.config_old")
  (prompt "make backup")
  (help "make backup help text")
)

; Copy new config
(copyfiles
  (prompt "Copying new config file")
  (help @copyfiles-help)
  (infos)
  (source "")
  (dest @default-dest)
  (choices "HippoPlayerIR.config")
)

)
) ; End If
(complete 50)
; Should copy source code ?
(set #source
  (askoptions
    (prompt "Copy HippoPlayerIR source code ?")
    (help @askoptions-help)
    (choices "src")
    (default 0)
  )
)
(set #copysource (BITAND (shiftright #source 0) 1))

; Yes - copy source code
(if (= #copysource 1)
(

; Copying source code
(copyfiles
  (prompt "Copying soure code...")
  (help @copyfiles-help)
  (infos)
  (source "")
  (dest @default-dest)
  (choices "src")
)

)
) ; End If
; Check if LikedMods volume exists
(set #likedfolder
  (exists "LikedMods:" (noreq))
)

; if LikedMods folder dosent exists
(if (= #likedfolder 0)
(

(complete 80)
; Ask for assign in user-startup
(set #likedassignoptions
  (askoptions
    (prompt "HippoPlayerIR can store your favourite modules in LikedMods: volume. If you already created a directory for liked modules, we can make a persistent assign to it in user-startup.")
    (help @askoptions-help)
    (choices "Add LikedMods assign in user-startup")
    (default 1)
  )
)
(set #addtouserstartup (BITAND (shiftright #likedassignoptions 0) 1))

)
) ; End If
; if user wants to modify user-startup
(if (= #addtouserstartup 1)
(

(complete 90)
; Choose location for LikedMods volume
(set #default-dest-installergen-temp
  (askdir
    (prompt "Choose location for liked modules")
    (help @askdir-help)
    (default @default-dest)
  )
)
(set @default-dest #default-dest-installergen-temp)

)
) ; End If
; if user want to add assign to user-startup
(if (= #addtouserstartup 1)
(

(complete 100)
; Add assign to user startup
(startup "HippoPlayerIR"
  (prompt "")
  (help @startup-help)
  (command
    (cat "Assign LikedMods: " @default-dest)
  )
)

)
) ; End If
