.KEY src,dest
.BRA {
.KET }

;
; Copy various things from temporary locations (or diskette) to
; permanent working locations.
;
; Inputs:
;    src   Where to find things.
;    dest  The directory to put them in.


ECHO " "
ECHO " "
ASK -dy "Copy PPage fonts to FONTS: directory [Y/N]? Y"
IF not warn

   ; If the fonts are in the temporary directory, copy them from there.
   IF exists {src}fonts

      FAILAT 21
      COPY {src}fonts FONTS: ALL QUIET

      IF error
          ECHO " "
          ECHO "--------------------------------------------------"
          ECHO "| No room for two copies of the fonts."
          ECHO "| Answer YES to the *"Cleanup installation files*""
          ECHO "| question, and then type"
          ECHO "|     COPY PPageUtil:fonts FONTS: ALL QUIET"
          ECHO "--------------------------------------------------"
      ENDIF

      FAILAT 10

      ; If this is indeed the temporary copy, delete it.
      IF not "{src}" eq "PPageUtil:"
         ECHO " "
         ECHO "     Deleting fonts from temporary storage ..."
         DELETE {src}fonts ALL QUIET
      ENDIF

   ELSE

      ; The fonts aren't in the temporary directory,
      ; so go back and use the floppy.
      COPY PPageUtil:fonts FONTS: ALL QUIET

   ENDIF

ENDIF   ; copy FONTS


ECHO " "
ASK -dy "Install the V1.3 printer.device in DEVS: directory [Y/N]? Y"
IF not warn

   IF EXISTS DEVS:printer.device
      ECHO " "
      IF NOT EXISTS DEVS:printer.device_old
         ECHO "     Renaming current printer.device to printer.device_old."
         RENAME DEVS:printer.device DEVS:printer.device_old
      ELSE
         ECHO "     Overwriting current printer.device"
      ENDIF
   ENDIF

   COPY PPage:devs/printer.device DEVS:

ENDIF    ; copy printer.device


ECHO " "
ASK -dy "Install the V1.3 printer drivers in DEVS:printers directory [Y/N]? Y"
IF not warn
   IF NOT EXISTS DEVS:printers
      MAKEDIR DEVS:printers
   ENDIF
   COPY PPage:devs/printers DEVS:printers ALL QUIET
ENDIF

;
; First, see if the user wants to copy Preferences to SYS: (which is where
; it is on the standard Workbench diskette).
;
; If he doesn't want it in SYS:, see if he wants it in the same directory
; as the rest of the PPage stuff.  (But don't bother if he's installing to
; SYS: -- there's no point asking him the same question twice.)
;
ECHO " "
ASK -dy "Copy V1.3 Preferences to SYS: [Y/N]? Y"
IF not warn

   IF EXISTS SYS:Preferences
      ECHO " "
      IF NOT EXISTS SYS:Preferences_old
         ECHO "     Renaming current Preferences to Preferences_old "
         RENAME SYS:Preferences SYS:Preferences_old
      ELSE
         ECHO "     Overwriting current Preferences"
      ENDIF
   ENDIF

   COPY {src}Preferences SYS:Preferences
   COPY {src}Preferences.info SYS:Preferences.info

ELSE     ; copy prefs to SYS:

   IF not "{dest}" eq SYS:

      ECHO " "
      ASK -dy "Copy V1.3 Preferences to {dest} [Y/N]? Y"
      IF not warn

         IF EXISTS {dest}Preferences
            ECHO " "
            IF NOT EXISTS {dest}Preferences_old
               ECHO "     Renaming current Preferences to Preferences_old "
               RENAME {dest}Preferences {dest}Preferences_old
            ELSE
                ECHO "     Overwriting current Preferences"
            ENDIF
         ENDIF
   
         COPY {src}Preferences {dest}Preferences
         COPY {src}Preferences.info {dest}Preferences.info

      ENDIF    ; copy prefs to {dest}

   ENDIF    ; "{dest}" eq SYS:

ENDIF    ; copy prefs to SYS:


IF not "{src}" eq "PPageUtil:"

   ECHO " "
   ASK -dn "Delete PPage Examples (NewsLetter and its pictures) [Y/N]? N"
   IF not warn
      FAILAT 21
   
      DELETE >nil: {src}NewsLetter
      DELETE >nil: {src}NewsLetter.info
      DELETE >nil: {src}Drawings ALL QUIET
      DELETE >nil: {src}Pictures ALL QUIET
   
      FAILAT 10
   ENDIF
   
   ECHO " "
   ASK -dn "Clean up installation temporary files [Y/N] N"
   IF not warn
      FAILAT 21
   
      DELETE >nil: {src}fonts ALL QUIET
      DELETE >nil: {src}Preferences
      DELETE >nil: {src}Preferences.info
      DELETE >nil: {src}misc ALL QUIET
   
      FAILAT 10
   ENDIF

ENDIF    ; "{src}" ne "PPageUtil:"
