
FailAt 21

Set DirName `CD`
Set ThemeName `PathPart FILE="$DirName"`
Set Answer `RequestChoice "Save the *"$ThemeName*" theme as default" "Are you sure you want to save*n*"$ThemeName*" as your default theme?*n*nThis will permanently replace your*nGUI and Palette preferences." Save Cancel`

If $Answer EQ 1
  Version > NIL: intuition.library VERSION 53
  If NOT WARN
    ; Copy settings supported by AmigaOS 4.1
    Copy CLONE QUIET Prefs/#?.prefs ENVARC:Sys/
    Copy QUIET Prefs/#?.prefs ENV:Sys/
  Else
    ; Copy AmigaOS 4.0-compatible settings only
    Copy CLONE QUIET Prefs/(gui|palette).prefs ENVARC:Sys/
    Copy QUIET Prefs/(gui|palette).prefs ENV:Sys/
  EndIf
  RequestChoice > NIL: "Operation done" "*"$ThemeName*" successfully saved as default theme." Ok TIMEOUTSECS=1
Else
  RequestChoice > NIL: "Operation cancelled" "*"$ThemeName*" theme was not saved." Ok
EndIf

Unset Answer
Unset ThemeName
Unset DirName
