; This is test of many of the features of the Installer
; Prints out debugging info if run from CLI

(transcript "\"MUI_WBPattern\" Install Script Results:")

(set prefpath
   (askdir
      (prompt "Where should \"MUI_WBPattern\" be installed?")
      (help @askdir-help)
      (default "SYS:Prefs/")
      (newpath)
   )
)

(set @default-dest prefpath)
(set name (tackon prefpath "MUI_WBPattern"))

(copyfiles
	(prompt ("Copying MUI_WBPattern to \"%s\" drawer..." prefpath))
	(help @copyfiles-help)
	(source "Prefs/")
   (all)
	(dest prefpath)
	(confirm)
)

(set startup-path
   (askdir
      (prompt "Where should the startup icon be installed?")
      (help @askdir-help)
      (default "SYS:WBStartup/")
   )
)

(copyfiles
	(prompt ("Copying MUI_WBPattern startup icon to \"%s\" drawer..." startup-path))
	(help @copyfiles-help)
	(source "WBStartup/")
   (all)
	(dest startup-path)
	(confirm)
)

(tooltype
   (prompt ("Changing default tool for startup icon to \"%s\"" name))
   (dest (tackon startup-path "MUI_WBPattern"))
   (setdefaulttool name)
   (noposition)
)

(tooltype
   (prompt "Freeing icon position...")
   (dest name)
   (noposition)
)

(if (askbool (prompt "Do you want the documentation installed?") (help @askbool))
   (
      (set doc-path
         (askdir
            (prompt "Where should the documentation icon be installed?")
            (help @askdir-help)
            (default prefpath)
         )
      )
      (copyfiles
         (prompt ("Copying Documentation to \"%s\"" doc-path))
         (help @copyfiles-help)
         (source "")
         (pattern "MUI_WBPattern.guide#?")
         (dest doc-path)
         (confirm)
      )
      (if (>= (getversion) 39)
         (set doc-tool "Multiview")
         (set doc-tool "Amigaguide")
      )
      (tooltype
         (dest (tackon doc-path "MUI_WBPattern.guide"))
         (setdefaulttool doc-tool)
         (noposition)
      )
   )
)

