; Installation script for AlphaSpell


(set cputype (+(database "CPU")) )

(if (< cputype 68020)
    (set src "ASpell000")
    (set src "ASpell020")
)

(set aspath
    (askdir
        (prompt "Install AlphaSpell where?")
        (help @askdir-help)
        (default "C:")
    )
)

(copyfiles
    (prompt "Copying AlphaSpell")
    (help @copyfiles-help)
    (source src)
    (newname "AlphaSpell")
    (dest aspath)
    (confirm)
)

(set destpath
    (askdir
        (prompt "Install AlphaSpell.guide where?")
        (help @askdir-help)
        (default "sys:Docs/")
    )
)

(copyfiles
    (prompt "Copying AlphaSpell's Documentation")
    (help @copyfiles-help)
    (source "Doc/")
    (dest destpath)
    (confirm)
    (all)
)

(set destpath
    (askdir
        (prompt "Install keyconv where?")
        (help @askdir-help)
        (default "C:")
    )
)

(copyfiles
    (prompt "Copying keyconv")
    (help @copyfiles-help)
    (source "keyconv")
    (dest destpath)
    (confirm)
)

(set destpath
    (askdir
        (prompt "Install the Dictionaries where?")
        (help @askdir-help)
        (default "Work:")
    )
)

(copyfiles
    (prompt "Copying AlphaSpell's Dictionaries")
    (help @copyfiles-help)
    (source "Dictionaries/")
    (dest destpath)
    (confirm)
    (all)
)

(set response
    (askchoice
        (prompt
            "Add Environment Variables?"
        )
        (help @askchoice-help)
        (choices "Yes" "No")
    )
)

(if (= response 0)
    (
        (run (cat "setenv DDIR " (tackon destpath " ")))
        (run ("setenv Dict English.low English.mix User.low User.mix"))
        (run (cat "setenv UDict " (tackon destpath "User.low") " " (tackon destpath "User.mix")))
        (run "copy ENV:Dict ENVARC:")
        (run "copy ENV:DDIR ENVARC:")
        (run "copy ENV:UDict ENVARC:")
    )
)

(message
    (cat "Installation complete.\n"
        "AlphaSpell has been installed as " (tackon aspath "AlphaSpell.")
    )
)

(exit (quiet))
