rmdir recursive as 2nd try
authorclaus
Sun, 12 Dec 1993 22:30:47 +0100
changeset 19 be0883868f0a
parent 18 e0994bb28ef5
child 20 1f5372bd0d2e
rmdir recursive as 2nd try
FileDir.st
FileDirectory.st
--- a/FileDir.st	Sun Dec 12 22:29:51 1993 +0100
+++ b/FileDir.st	Sun Dec 12 22:30:47 1993 +0100
@@ -26,7 +26,7 @@
 They provide various methods to create/delete and query for files and/or
 directories.
 
-$Header: /cvs/stx/stx/libbasic/Attic/FileDir.st,v 1.5 1993-12-11 00:47:59 claus Exp $
+$Header: /cvs/stx/stx/libbasic/Attic/FileDir.st,v 1.6 1993-12-12 21:30:47 claus Exp $
 
 written winter 89 by claus
 '!
@@ -283,12 +283,19 @@
 !
 
 removeDirectory:dirName
-    "remove the directory 'dirName' from myself; return true if successful"
+    "remove the directory 'dirName' from myself; return true if successful.
+     If the directory is not empty, the containign files/directories are also
+     removed."
+
+    |absPath|
 
     (dirName startsWith:'/') ifTrue:[
-        ^ OperatingSystem removeDirectory:dirName
+        absPath := dirName
+    ] ifFalse:[
+        absPath := pathName , '/' , dirName
     ].
-    ^ OperatingSystem removeDirectory:(pathName , '/' , dirName)
+    (OperatingSystem removeDirectory:absPath) ifTrue:[^ true].
+    ^ OperatingSystem recursiveRemoveDirectory:absPath
 !
     
 remove:aFileOrDirectoryName
--- a/FileDirectory.st	Sun Dec 12 22:29:51 1993 +0100
+++ b/FileDirectory.st	Sun Dec 12 22:30:47 1993 +0100
@@ -26,7 +26,7 @@
 They provide various methods to create/delete and query for files and/or
 directories.
 
-$Header: /cvs/stx/stx/libbasic/FileDirectory.st,v 1.5 1993-12-11 00:47:59 claus Exp $
+$Header: /cvs/stx/stx/libbasic/FileDirectory.st,v 1.6 1993-12-12 21:30:47 claus Exp $
 
 written winter 89 by claus
 '!
@@ -283,12 +283,19 @@
 !
 
 removeDirectory:dirName
-    "remove the directory 'dirName' from myself; return true if successful"
+    "remove the directory 'dirName' from myself; return true if successful.
+     If the directory is not empty, the containign files/directories are also
+     removed."
+
+    |absPath|
 
     (dirName startsWith:'/') ifTrue:[
-        ^ OperatingSystem removeDirectory:dirName
+        absPath := dirName
+    ] ifFalse:[
+        absPath := pathName , '/' , dirName
     ].
-    ^ OperatingSystem removeDirectory:(pathName , '/' , dirName)
+    (OperatingSystem removeDirectory:absPath) ifTrue:[^ true].
+    ^ OperatingSystem recursiveRemoveDirectory:absPath
 !
     
 remove:aFileOrDirectoryName