;**********************************************************
;
;    Installation script for Loves v1.0
;       v0.31
;
;**********************************************************

;************
; PROCEDURES
;************

(procedure choosestuff
    (
        (set @default-dest
            (askdir
                (prompt "Choose where you would like to install the Loves executable. The installer will NOT create a directory!")
                (help @askdir-help)
                (default @default-dest)
            )
        )
        (set docdir
            (askdir
                (prompt "Choose where you would like to install the Loves documentation, again NO directory will be created!")
                (help @askdir-help)
                (default @default-dest)
            )
        )
        (set icons
            (askchoice
                (prompt "What type of icons would you like to install?")
                (help "You can choose between three types of icons for Loves.\n\nMagicWB - An goodlooking standard created by Martin Huttenloher. 1:1 Pixel aspect (e.g. Hires Interlaced), 8-color.\n\nSmallbench - The same as MagicWB but for non-proportional screens, by Tom Oszczepalski & Paul Henrik. 1:2 pixel-aspect (e.g. Hires NoLace.) 8-color.\n\nNormal - The standard Workbench icons. 1:2 pixel aspect, 4-color, ugly.")
                (choices "MagicWB" "Smallbench (NoLace)" "Normal Workbench icons")
            )
        )
        (if
            (= icons 0)
            (set icontype "MagicWB")
        )
        (if
            (= icons 1)
            (set icontype "Smallbench")
        )
        (if
            (= icons 2)
            (set icontype "Normal")
        )
    )
)

;********
;  MAIN
;********

; *****************************
;  Check for correct OS (2.0+)
; *****************************

(if (< (/ (getversion) 65536) 37)
    (abort "Loves requires at least AmigaOS v2.0.")
)

; *****************************
;  Choose where&what to install
; *****************************

(choosestuff)

(until
    (askbool
        (prompt ("The following files will now be copied:\n\nThe executable in:\n%s\n\nand The docs in:\n%s\n\nYou have chosen the %s icons.\n\nIs this OK?" @default-dest docdir icontype))
        (help "If you choose `Copy Files', the files will be copied in respective directories, if you choose `Choose Again', you can choose other places for the files.")
        (choices "Copy Files" "Choose again")
    )
    (choosestuff)
)

(copyfiles
    (prompt "The executable")
    (source "Loves")
    (dest @default-dest)
)
(copyfiles
    (prompt "The executable icon")
    (source ("Icons/%s/Loves.info" icontype))
    (dest @default-dest)
)
(copyfiles
    (prompt "The documentation")
    (source "Loves.guide")
    (dest docdir)
)
(copyfiles
    (prompt "The Documentation icon")
    (source ("Icons/%s/Loves.guide.info" icontype))
    (dest @default-dest)
)
