changed:
authorClaus Gittinger <cg@exept.de>
Thu, 19 Jan 2012 17:20:58 +0100
changeset 13949 b82c0fc2b875
parent 13948 5c482fe46e20
child 13950 a997dd517a4c
changed: #recursiveRemoveAll #recursiveRemoveWithoutOSCommand back to the old algorithm
Filename.st
--- a/Filename.st	Thu Jan 19 13:09:48 2012 +0100
+++ b/Filename.st	Thu Jan 19 17:20:58 2012 +0100
@@ -2855,56 +2855,6 @@
     "
 !
 
-new_recursiveRemoveAll
-    "Remove all of my subfiles/subdirectories.
-     Raise an error if not successful.
-     This one walks down the directory hierarchy, not using any OS
-     command to do the remove."
-
-    |files toRemove fileToRemove|
-
-    self isDirectory ifFalse:[^ self].
-    files := self directoryContentsAsFilenames.
-    files isEmpty ifTrue:[^ self].
-
-    toRemove := OrderedCollection new.
-    toRemove addAll:files.
-    [ toRemove notEmpty ] whileTrue:[
-        fileToRemove := toRemove removeLast.
-        Error handle:[:ex |
-            |children|
-
-            fileToRemove isDirectory ifTrue:[
-                children := fileToRemove directoryContentsAsFilenames.
-                children isEmpty ifTrue:[
-                    fileToRemove remove
-                ] ifFalse:[
-                    toRemove add:fileToRemove.
-                    toRemove addAll:children.
-                ].
-            ] ifFalse:[
-                ex reject 
-            ].
-        ] do:[
-            "/ Transcript showCR:('remove: ', fileToRemove pathName).
-            fileToRemove remove.
-        ].
-    ].
-
-    "
-     'foo' asFilename makeDirectory.
-     'foo/bar' asFilename writeStream close.
-     'foo' asFilename remove
-    "
-    "
-     'foo' asFilename makeDirectory.
-     'foo/bar' asFilename writeStream close.
-     'foo' asFilename recursiveRemove
-    "
-
-    "Created: / 11-10-2011 / 10:28:09 / cg"
-!
-
 recursiveCopyTo:destination
     "if I represent a regular file, copy it.
      Otherwise, copy the directory and recursively
@@ -3058,7 +3008,8 @@
                 f := self construct:aFilenameString.
                 Error handle:[:ex |
                     f isDirectory ifFalse:[ ex reject ].
-                    f recursiveRemoveWithoutOSCommand
+                    f recursiveRemoveAll.
+                    f removeDirectory
                 ] do:[
                     f remove
                 ].
@@ -3093,8 +3044,7 @@
      This one walks down the directory hierarchy, not using any OS
      command to do the remove."
 
-    self new_recursiveRemoveAll.
-    "/ self recursiveRemoveAll.
+    self recursiveRemoveAll.
     self remove
 
     "
@@ -3109,7 +3059,7 @@
     "
 
     "Created: / 25-02-1998 / 19:50:40 / cg"
-    "Modified: / 11-10-2011 / 10:29:20 / cg"
+    "Modified: / 19-01-2012 / 17:18:28 / cg"
 !
 
 remove
@@ -5929,11 +5879,11 @@
 !Filename class methodsFor:'documentation'!
 
 version
-    ^ '$Header: /cvs/stx/stx/libbasic/Filename.st,v 1.372 2011-12-25 10:35:01 cg Exp $'
+    ^ '$Header: /cvs/stx/stx/libbasic/Filename.st,v 1.373 2012-01-19 16:20:58 cg Exp $'
 !
 
 version_CVS
-    ^ '$Header: /cvs/stx/stx/libbasic/Filename.st,v 1.372 2011-12-25 10:35:01 cg Exp $'
+    ^ '$Header: /cvs/stx/stx/libbasic/Filename.st,v 1.373 2012-01-19 16:20:58 cg Exp $'
 ! !
 
 Filename initialize!