(procedure P_WRip
 ((message ("\n\nInsert %s disk %ld into drive %s" @app-name #NUM #CI_drive))
  (working "\n\n\nRipping files from disk...")
  (if	(= 0 (run ("cd \"%s\"\nWRip %s >con:0/0//100//AUTO/CLOSE" #dest #CI_drive)))
	("")
	(abort "\"WRip\" must be in your PATH (preferably in C:) !!!")
  )
  (run ("cd \"%s\"\nexecute WRip%ld.script\ndelete WRip%ld.script" #dest #NUM #NUM))
))

(if	(exists "Games:" (noreq))
	(set @default-dest "Games:")
	(if	(exists "SYS:Games" (noreq))
		(set @default-dest "SYS:Games")
		(if	(exists "Work:Games" (noreq))
			(set @default-dest "Work:Games")
			(if	(exists "JEUX:" (noreq) )
				(set @default-dest "JEUX:")
				(set @default-dest "SYS:")
			)
		)
	)
)
(message "\nThe Moochies HD-Loader by Mick of Lost Bullet\n\n\nInstallation Requirements:\n\nWRip for diskripping and 1.5Mb HD-Space\n\n\nOther Requirements:\n\nThe WHDLoad program, 0.5Mb CHIP and 2.0Mb FASTRAM")

(set #dest
 (askdir
	(prompt ("Where should %s installed ?\nA drawer \"%s\" will automatically created." @app-name @app-name))
	(help @askdir-help)
	(default @default-dest)
	(disk)
))
(set @default-dest (tackon #dest @app-name))

(if (exists @default-dest)
    ((set #choice
      (askbool
	(prompt ("\nDirectory \"%s\" already exists.\nShould it be deleted ?" @default-dest))
	(default 1)
	(choices "Delete" "Skip")
	(help @askbool-help)
     ))
     (if (= #choice 1)
	 (run ("Delete \"%s\" \"%s.info\" All" @default-dest @default-dest))
    ))
)
(set #CI_unit
 (askchoice
	(prompt "\nSelect source drive to install from\n")
	(help @askoptions-help)
	(choices "DF0:" "DF1:" "DF2:" "RAD:" "Enter Device")
))
(if	(< #CI_unit 3)
	(set #CI_drive ("DF%ld:" #CI_unit))
	(if	(= #CI_unit 3)
		(set #CI_drive "RAD:")
		(set #CI_drive
		 (askstring
			(prompt "\nEnter source drive to install from")
			(default "DF0:")
			(help @askstring-help)
		))
	)
)
(makedir @default-dest (infos))

(copyfiles
	(source "data")
	(dest @default-dest)
	(all)
)
(set #dest (tackon @default-dest "TheMoochiesData"))

(set #NUM 1) (P_WRip)
(set #NUM 2) (P_WRip)

(copyfiles
	(source ("%s.readme" @app-name))
	(dest @default-dest)
	(newname "README")
	(infos)
)
(exit)
