;
; Installer Script for Flowerpower's datatypes
; $VER: 40.1 (30.1.95)
;
; permission is hereby granted to use this script for whatever you want.
; print it and make a fire of it if you like.
;

(set #basename   "adpcm")
(set #descriptor "ADPCM")

(set @default-dest "SYS:")

(if (askchoice (prompt @app-name)
               (help @askchoice-help)
               (choices "Installation" "De-Installation"))

; De-Installation

    (
        (delete (cat "SYS:Classes/Datatypes/" #basename ".datatype")
                (prompt "The class file will now be deleted from \"SYS:Classes/Datatypes\".")
                (help "No help available.")
                (confirm) )
        
        (delete (cat "DEVS:Datatypes/" #descriptor)
                (prompt "The descriptor will now be deleted from \"DEVS:Datatypes\".")
                (help "No help available.")
                (confirm)
                (infos) )

        (run "C:AddDataTypes Refresh")
        (run "C:Avail >NIL: Flush")

        (message "De-Installation complete!\n"
              @app-name
               " was removed from your "
              "\"" @default-dest "\" "
              "drawer\n(or partition) "
              "and is no longer usable.\n"
              "(Even if you do NOT reboot your machine ;-)")
        (exit (quiet))
)

; Installation

    (
        (copylib   (source (cat "Classes/Datatypes/" #basename ".datatype"))
                   (dest "SYS:Classes/Datatypes")
                   (prompt "The class file will now be copied to \"SYS:Classes/Datatypes\".")
                   (help @copylib-help)
                   (confirm))

        (copyfiles (source "Devs/Datatypes/")
                   (dest "DEVS:Datatypes")
                   (choices #descriptor (cat #descriptor ".info"))
                   (prompt "The descriptor file will now be copied to \"DEVS:Datatypes\".")
                   (help @copyfiles-help)
                   (confirm))
        
        (run "C:Avail >NIL: Flush")
        (run "C:AddDataTypes Refresh")

        (message "Installation complete!\n"
              @app-name
               " can be found in your "
              "\"" @default-dest "\" "
              "drawer\n(or partition) "
              "and is ready for use.\n"
              "(You need NOT reboot your machine).")
        (exit (quiet))
    )

)
