;
; $PROJECT: c.datatype
;
; $VER: Install 39.1 (12.03.95)
;
; by
;
; Stefan Ruppert , Windthorststrae 5 , 65439 Flrsheim , GERMANY
;
; (C) Copyright 1995
; All Rights Reserved !
;
; $HISTORY:
;
; 12.03.95 : 039.001 : initial
;

(set cpu (database "cpu"))

(set #datatype "c.datatype")
(set #datatype-desc (cat "C(%|++)-Source"))

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

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

; get classes dir
(set classdir
		  (askdir
					 (prompt "Where do the Classes belong")
					 (help @askdir-help)
					 (default "SYS:Classes")
		  )
)

; now do install or remove
(if mode
		  ; Remove
		  (
					 ; Show what we are doing
					 (working "Removing " @app-name)

					 ; Remove the non-standard pieces
					 (delete (tackon classdir "datatypes" #datatype))
					 (delete (cat "devs:datatypes/" #datatype-desc) (infos))

					 ; Don't want to use the confusing "Installation Complete" message
					 ; when what we really did was remove things...
					 (message "The \"" @app-name "\" components "
								 "that you specified have been successfully removed")
					 (exit (quiet))
		  )

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

					 (set #dtname (tackon "classes/datatypes" #datatype))

					 ; Install the classes
					 (if (OR (= cpu "68000") (= cpu "68010"))
						  (run (cat "copy >NIL: " #dtname ".000 t:" #datatype))
						  (run (cat "copy >NIL: " #dtname ".020 T:" #datatype))
					 )

					 ; Install the classes
					 (copylib
								(prompt (cat "Copying " @app-name))
								(help @copylib-help)
								(source (tackon "t:" #datatype))
								(dest (tackon classdir "DataTypes"))
								(confirm)
					 )

					 (run (cat "delete >NIL: t:" #datatype))

					 ; Install the descriptors
					 (copyfiles
								(prompt "Copying the Descriptors")
								(help @copyfiles-help)
								(source "devs/datatypes")
								(dest "DEVS:DataTypes")
								(pattern "#?")
								(infos)
								(confirm)
					 )

					 ; Install prefs file
					 (if     (askbool
										  (prompt "Install Prefs file ?")
										  (help @askbool-help)
								)
								(
										  (copyfiles
													 (help @copyfiles-help)
													 (source "envarc/datatypes/c.prefs")
													 (dest "EnvArc:DataTypes")
										  )
										  (copyfiles
													 (help @copyfiles-help)
													 (source "envarc/datatypes/c.prefs")
													 (dest "Env:DataTypes")
										  )
								)
					 )

					 ; install doc file
					 (copyfiles
								(prompt "Copying autodoc file")
								(help @copyfiles-help)
								(source "doc")
								(dest "AutoDocs:")
								(pattern "#?")
								(confirm)
					 )

					 ; install AmigaGuide file
					 (copyfiles
								(prompt "Copying AmigaGuide file")
								(help @copyfiles-help)
								(source "help")
								(dest "AmigaGuide:")
								(pattern "#?")
								(confirm)
					 )

					 ; Tell the system about the new descriptors
					 (run "C:AddDataTypes Refresh")

		  )
)

(set @default-dest classdir)

