I have a question about the behavior of two methods in Directory.
I get this from filesMatching: st> var2 filesMatching: 'test*' do: [:file | ( file name) display. st> ', ' display. st> file printNl ] ! /Users/johnp/projects/smalltalk/gnu/test.st, a File /Users/johnp/projects/smalltalk/gnu/testing, a Directory /Users/johnp/projects/smalltalk/gnu/testing3, a Directory and I get this from allFilesMatching: var2 allFilesMatching: 'test*' do: [:file | (file name) display. st> ', ' display. st> file printNl] ! /Users/johnp/projects/smalltalk/gnu/test.st, a File /Users/johnp/projects/smalltalk/gnu/testing3/testing3-file, a File /Users/johnp/projects/smalltalk/gnu/testing3/testing3-file-2, a File Shouldn't they produce the same objects? I mean either all files and directories or just files? _______________________________________________ help-smalltalk mailing list [hidden email] http://lists.gnu.org/mailman/listinfo/help-smalltalk |
> st> var2 filesMatching: 'test*' do: [:file | ( file name) display. > st> ', ' display. > st> file printNl ] ! > /Users/johnp/projects/smalltalk/gnu/test.st, a File > /Users/johnp/projects/smalltalk/gnu/testing, a Directory > /Users/johnp/projects/smalltalk/gnu/testing3, a Directory This one does not descend into directories, and returns files or directories that match 'test*'. > and I get this from allFilesMatching: > var2 allFilesMatching: 'test*' do: [:file | (file name) display. > st> ', ' display. > st> file printNl] ! > /Users/johnp/projects/smalltalk/gnu/test.st, a File > /Users/johnp/projects/smalltalk/gnu/testing3/testing3-file, a File > /Users/johnp/projects/smalltalk/gnu/testing3/testing3-file-2, a File This one descends into directories (not symlinks to directories) irrespective of whether they match 'test*', and returns file in those directories that match 'test*'. If the method comment is not helpful, please propose an alternative wording. Paolo _______________________________________________ help-smalltalk mailing list [hidden email] http://lists.gnu.org/mailman/listinfo/help-smalltalk |
In reply to this post by J Pfersich
On Mon, 2007-01-08 at 23:03 -0700, J Pfersich wrote:
> I have a question about the behavior of two methods in Directory. > I get this from filesMatching: > st> var2 filesMatching: 'test*' do: [:file | ( file name) display. > st> ', ' display. > st> file printNl ] ! > /Users/johnp/projects/smalltalk/gnu/test.st, a File > /Users/johnp/projects/smalltalk/gnu/testing, a Directory > /Users/johnp/projects/smalltalk/gnu/testing3, a Directory > > and I get this from allFilesMatching: > var2 allFilesMatching: 'test*' do: [:file | (file name) display. > st> ', ' display. > st> file printNl] ! > /Users/johnp/projects/smalltalk/gnu/test.st, a File > /Users/johnp/projects/smalltalk/gnu/testing3/testing3-file, a File > /Users/johnp/projects/smalltalk/gnu/testing3/testing3-file-2, a File > > Shouldn't they produce the same objects? I mean either all files and > directories or just files? directories are "in" .../gnu/. allFilesMatching:do: does seem like it should call its block with a superset of those found by filesMatching:do:, though. Attached is a patch that implements this behavior by modifying Directory>>allFilesMatching:do:. -- Stephen Compall http://scompall.nocandysw.com/blog _______________________________________________ help-smalltalk mailing list [hidden email] http://lists.gnu.org/mailman/listinfo/help-smalltalk |
> 2007-01-09 Stephen Compall <[hidden email]> > > * kernel/Directory.st (allFilesMatching:do:): Pass Directory > entries to aBlock if they match aPattern. I have no problems with this patch if there's consensus that this behavior is better. Actually, unless somebody stands up, I'll apply it in a couple of days. Thanks, Paolo _______________________________________________ help-smalltalk mailing list [hidden email] http://lists.gnu.org/mailman/listinfo/help-smalltalk |
Paolo Bonzini wrote:
> >> 2007-01-09 Stephen Compall <[hidden email]> >> >> * kernel/Directory.st (allFilesMatching:do:): Pass Directory >> entries to aBlock if they match aPattern. > > I have no problems with this patch if there's consensus that this > behavior is better. Actually, unless somebody stands up, I'll apply it > in a couple of days. It gets my vote. Mike _______________________________________________ help-smalltalk mailing list [hidden email] http://lists.gnu.org/mailman/listinfo/help-smalltalk |
Free forum by Nabble | Edit this page |