; installation script for ANSI-Draw
; (c) 1995 Kjell Andersson


(set destdir
        (askdir
                (prompt "Please indicate where you want the ANSI-Draw drawer to be created.")
                (help @askdir-help)
                (default @default-dest)
        )
)

(set destdir (tackon destdir "ANSI-Draw"))


(if (= destdir "") (set destdir (tackon @default-dest "ANSI-Draw")))


(if (= (exists destdir) 2)
        (if
                (askbool
                        (prompt "\n"
                                "The directory \"" destdir "\" already exists, do you wish to"
                                " replace the old files?" )
                        (help "The old files placed in this directory will be replaced"
                                        " by the new ones.")
                )
                (set dummy 0)
                (abort "Installation not done.\nAll files are intact.")
        )
        (if
                (askbool
                        (prompt "\n"
                                "I'm going to create the directory \""destdir "\" were all "
                                "files needed for ANSI-Draw will be placed.\n\n"
                                "You have " (getdiskspace((pathonly destdir))) " bytes free "
                                "on \"" (pathonly destdir) "\".\n"
                                "Approximately 160000 bytes will be needed for installation.\n\n"
                                "Do you wish to continue?")
                        (help "A directory will be created and all vital files will be"
                                        " copied into the created directory.")
                )
                (set dummy 0)
                (abort "Installation not done.\nNo directory created.")
        )
)

(if (<> (exists destdir) 2) (makedir destdir (infos)))
(if (<> (exists destdir) 2) (makedir (tackon destdir "Prefs")))

(set @default-dest destdir)

(copyfiles (source "RegForm.txt") (dest destdir))
(copyfiles (source "ANSI-Draw") (dest destdir) (infos))
(copyfiles (source "ANSI-Draw.guide") (dest destdir) (infos))
(if (= (exists "FONTS:PC") 2)
   (if (askbool (prompt "\nYou already have a font in your FONTS: that is "
                    "named PC, do you wish to replace it with my one?\n")
            (help "If you select yes on this question your old font "
                  "will be replaced"))
      (set dummy 1)
   )

   (if (askbool (prompt "\nI am going to place a font named PC "
                    "in your FONTS:\n"
                    "\nIs it OK for me to do that?\n")
            (help "If you select yes on this question a new font "
                  "named PC will be placed in your FONTS:"))
      (set dummy 1)
   )
)
(if (= dummy 1) (copyfiles (source "fonts") (dest "FONTS:") (infos) (all)))
(if (askbool (prompt "\nDo you wish to copy the example files?\n")
             (help "The examplefiles are (ANSI) pictures drawn in ANSI-Draw.\n"
                   "(They won't take that much diskspace.)\n")
   )
   (copyfiles (source "Examples") (dest (tackon destdir "Examples")) (infos) (all))
)
