;
; $PROJECT: PointerEyes 4.3
;
; (C) Copyright 1995 John Hughes.  All Rights Reserved.
;

(if (< (/ (getversion) 65536) 39)  ;if this is OS2.x
  (
    (message "\n\nPointerEyes 4.x is for AmigaDos 3.0 or greater.\n\nPlease install version 3.x.")
    (exit (quiet))
  )
)

(message "\n\nIf PointerEyes is currently running, please quit it before continuing.  The installation may not work properly if Pointer Eyes is running.")

(set mode
	  (askchoice
			(prompt @app-name)
			(help @askchoice-help)
			(choices "Install" "Remove")
	  )
)

(if mode
		  (set pmode "Remove")
		  (set pmode "Install")
)

; GET INSTALL DIRECTORY
(set installdir
		  (askdir
					 (prompt "Where do you want to put the PointerEyes executable?")
					 (help @askdir-help)
					 (default "SYS:WBStartup")
		  )
)

; do install or remove
(if mode
		  ; Remove
		  (
					 (working "Removing " @app-name)

					 ; Remove the non-standard pieces
					 (delete (tackon installdir "PointerEyes") (infos))
					 (delete (tackon installdir  "PointerEyesImages/OriginalEyes.8") (infos))
					 (delete (tackon installdir  "PointerEyesImages/OriginalEyes.11") (infos))
					 (delete (tackon installdir  "PointerEyesImages/OriginalEyes.13") (infos))
					 (delete (tackon installdir  "PointerEyesImages/MagicWBEyes.8") (infos))
					 (delete (tackon installdir  "PointerEyesImages/MagicWBEyes.11") (infos))
					 (delete (tackon installdir  "PointerEyesImages/MagicWBEyes.13") (infos))
					 (delete (tackon installdir  "PointerEyesImages/ShadedEyes.8") (infos))
					 (delete (tackon installdir  "PointerEyesImages/ShadedEyes.11") (infos))
					 (delete (tackon installdir  "PointerEyesImages/ShadedEyes.13") (infos))
					 (delete (tackon installdir  "PointerEyesImages/RedYellowEyes.11") (infos))
					 (delete (tackon installdir  "PointerEyesImages/DiamondEyes.11") (infos))
					 (delete (tackon installdir  "PointerEyesImages") (infos))

					 (message "Pointer Eyes has been successfully removed.\nscreennotify.library was left in libs: since\nother applications you have may need it.")
					 (exit (quiet))
		  )

		  ; Install
		  (
					 (working "Installing " @app-name)

					 ; Install the Executable
					 (copyfiles
								(prompt "Copying the PointerEyes Executable")
								(help @copyfiles-help)
								(source "PointerEyes")
								(dest installdir)
								(infos)
					 )

					 ; Install the library
					 (copylib
								(prompt "Copying screennotify.library")
								(help @copylib-help)
								(source "/libs/screennotify.library")
								(dest "libs:")
								(confirm)
					 )

					 ; Install the Image directory
					 (copyfiles
								(prompt "Copying the Image Directory")
								(help @copyfiles-help)
								(source "PointerEyesImages")
								(dest (tackon installdir "PointerEyesImages"))
								(pattern "#?")
					 )

					 ; install AmigaGuide file
					 (copyfiles
								(prompt "Copying AmigaGuide file")
								(help @copyfiles-help)
								(source "/Docs/PointerEyes.guide")
								(dest "AmigaGuide:")
								(confirm)
					 )

		  )
)

(set @default-dest installdir)
