Filename.st
branchjv
changeset 17815 956b46750806
parent 17814 b75a7f0c346b
child 17834 04ff72c5039a
--- a/Filename.st	Mon Dec 20 07:13:27 2010 +0000
+++ b/Filename.st	Fri Feb 04 23:09:23 2011 +0000
@@ -2061,6 +2061,25 @@
     "Modified: / 29-05-2007 / 12:02:46 / cg"
 !
 
+recursiveDirectoryContentsAsFilenamesDo:aBlock 
+    "evaluate aBlock for all files and directories found under the receiver.
+     The block is invoked with the filenames as argument.
+     The walk is bread-first.
+     This excludes any entries for '.' or '..'.
+     Subdirectory files are included with a relative pathname.
+     Warning: this may take a long time to execute (especially with deep and/or remote fileSystems)."
+
+    self recursiveDirectoryContentsDo:[:relFn |
+        aBlock value:(self construct:relFn)
+    ].
+
+    "
+     '.' asFilename recursiveDirectoryContentsAsFilenamesDo:[:f | Transcript showCR:f] 
+    "
+
+    "Modified: / 12-09-2010 / 15:43:22 / cg"
+!
+
 recursiveDirectoryContentsDo:aBlock 
     "evaluate aBlock for all files and directories found under the receiver.
      The block is invoked with the relative filenames as string-argument.
@@ -2683,7 +2702,7 @@
 
         [
             inStream copyToEndInto:outStream.
-        ] on:OperatingSystem errorSignal do:[:ex|
+        ] on:Error do:[:ex|
             ^ self fileCreationError:newName
         ]
     ] ensure:[
@@ -2961,9 +2980,8 @@
     "Modified: / 5.5.1999 / 13:43:35 / cg"
 !
 
-recursiveRemoveWithoutOSCommand
-    "if I represent a regular file, remove it.
-     Otherwise, remove the directory and all of its subfiles/subdirectories.
+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."
@@ -2991,6 +3009,29 @@
             ].
         ]
     ].
+
+    "
+     'foo' asFilename makeDirectory.
+     'foo/bar' asFilename writeStream close.
+     'foo' asFilename remove
+    "
+    "
+     'foo' asFilename makeDirectory.
+     'foo/bar' asFilename writeStream close.
+     'foo' asFilename recursiveRemove
+    "
+
+    "Created: / 25-01-2011 / 16:42:15 / cg"
+!
+
+recursiveRemoveWithoutOSCommand
+    "if I represent a regular file, remove it.
+     Otherwise, remove the directory and all of its subfiles/subdirectories.
+     Raise an error if not successful.
+     This one walks down the directory hierarchy, not using any OS
+     command to do the remove."
+
+    self recursiveRemoveAll.
     self remove
 
     "
@@ -3004,8 +3045,8 @@
      'foo' asFilename recursiveRemove
     "
 
-    "Created: / 25.2.1998 / 19:50:40 / cg"
-    "Modified: / 25.2.1998 / 19:52:08 / cg"
+    "Created: / 25-02-1998 / 19:50:40 / cg"
+    "Modified: / 25-01-2011 / 16:42:24 / cg"
 !
 
 remove
@@ -5792,15 +5833,15 @@
 !Filename class methodsFor:'documentation'!
 
 version
-    ^ '$Id: Filename.st 10602 2010-12-20 07:13:27Z vranyj1 $'
+    ^ '$Id: Filename.st 10604 2011-02-04 23:09:23Z vranyj1 $'
 !
 
 version_CVS
-    ^ 'Header: /cvs/stx/stx/libbasic/Filename.st,v 1.361 2010/11/19 13:25:20 stefan Exp '
+    ^ 'Header: /cvs/stx/stx/libbasic/Filename.st,v 1.365 2011/01/25 15:46:32 cg Exp '
 !
 
 version_SVN
-    ^ '$Id: Filename.st 10602 2010-12-20 07:13:27Z vranyj1 $'
+    ^ '$Id: Filename.st 10604 2011-02-04 23:09:23Z vranyj1 $'
 ! !
 
 Filename initialize!
@@ -5813,3 +5854,4 @@
 
 
 
+