/* LiveWire/WPS DE-installation script */
/* TO BE USED ONLY IN CONJUNCTION WITH */
/* THE DEINST.EXE PROGRAM !!!          */

/* Send all commands only to CMD.EXE */
ADDRESS CMD.EXE

/* Install REXX system functions */
call rxfuncadd sysloadfuncs, rexxutil, sysloadfuncs
call sysloadfuncs

/* Determine the path to LiveWire */
DeInstallPath = ARG(1)
if (DeInstallPath = "") then Exit
DeInstallSpec = DeInstallPath||"\*"

/* Begin installation */
ECHO OFF
call SysCls
Say ""
Say "LiveWire/WPS DeInstall Script"
Say ""
Say "Deleting the following folders:"

/* Get the directory tree */
call SysFileTree DeInstallSpec, 'DirTree', 'DS'

/* Erase contents of the directories */
do i=1 to DirTree.0
   DirTree.i = SUBSTR(DirTree.i, 38)
   Say DirTree.i
   "erase" DirTree.i "/N"
end

/* Remove the directories */
do i=DirTree.0 to 1 by -1
   "rmdir" DirTree.i
end

/* Remove the main directory */
"erase" DeInstallPath "/N"
"rmdir" DeInstallPath

/* Remove us from the startup folder */
ret = SysDestroyObject("<LW30_DEINSTALL>");
ret = SysDestroyObject("<LW_FOLDER_TEMPLATE>");
ret = SysDestroyObject("<LIVEWIRE30_MAIN_FOLDER>");

/* Delete us! */
erase LWDEINST.CMD
