[BUG][FIX]FileDirectory>withAllFilesDo:andDirectoriesDo:

Tim Rowledge tim at sumeru.stanford.edu
Tue Jun 18 01:57:02 UTC 2002


FileDirectory>withAllFilesDo:andDirectoriesDo: failed to close files after opening them. Fixed

tim
-- 
Tim Rowledge, tim at sumeru.stanford.edu, http://sumeru.stanford.edu/tim
Useful random insult:- Strong, like bull.  Smart, like tractor.  Beautiful, like KV-2. (A WWII era Russian tank.)
-------------- next part --------------
'From Squeak3.2gamma of 15 January 2002 [latest update: #4827] on 17 June 2002 at 6:29:22 pm'!
"Change Set:		FileDirectory>withAllFiles
Date:			17 June 2002
Author:			tim at sumeru.stanford.edu

FileDirectory>withAllFilesDo:andDirectoriesDo: failed to close files after opening them. Fixed"!


!FileDirectory methodsFor: 'searching' stamp: 'tpr 5/6/2002 15:10'!
withAllFilesDo: fileStreamBlock andDirectoriesDo: directoryBlock

	"For the receiver and all it's subdirectories evaluate directoryBlock.
	For a read only file stream on each file within the receiver 
	and it's subdirectories evaluate fileStreamBlock."

	| todo dir fs|

	todo _ OrderedCollection with: self.
	[todo size > 0] whileTrue: [
		dir _ todo removeFirst.
		directoryBlock value: dir.
		dir fileNames do: [: n |
			fs _ FileStream readOnlyFileNamed: (dir fullNameFor: n). 
			fileStreamBlock value: fs.
			fs close].
		dir directoryNames do: [: n | 
			todo add: (dir directoryNamed: n)]]

! !



More information about the Squeak-dev mailing list