Hi again,
I'm seeing differences between Windows and Linux in CfsDirectoryDescriptor. I need to search for and list all existing files named "fadat*.txt" in a directory. The files are there. On windows, the pattern 'fadat*.txt' brings up a list of files. On Linux, it doesn't. Changing the pattern to 'fadat*' brings up the list I'd expect (apart from the fact that .xls or .zip also are included in the list). Is that a bug or expected behavior? The ls command on linux can handle fadat*.txt... Here's the code I am using: collection := OrderedCollection new. (dd := CfsDirectoryDescriptor opendir: self currentDirectory pattern: 'fadat*.txt' mode: FREG | FDIR) isCfsError ifTrue: [self error: dd message]. [(de := dd readdir) notNil] whileTrue: [collection add: de]. dd closedir. collection inspect Thanks for reading Joachim
-- You received this message because you are subscribed to the Google Groups "VA Smalltalk" group. To view this discussion on the web visit https://groups.google.com/d/msg/va-smalltalk/-/fi_7Bhbgj48J. To post to this group, send email to [hidden email]. To unsubscribe from this group, send email to [hidden email]. For more options, visit this group at http://groups.google.com/group/va-smalltalk?hl=en. |
Hello Joachim,
I don't have 8.5 handy, but this is a bug which I ran into years ago, and I know exists until at least 8.0. Unfortunately, I never wrote it up for Instantiations. I didn't even fix it, I just worked around it. On Windows the file filtering is done in a windows API call by the OS. On *nix it is done in the method CfsDirectoryDescriptor>>basicReaddir:for:. The actual bug, I believe, is in String>>indexOf:matchCase:startingAt: For instance 'dummy.txt' indexOf: 'dumm*.txt' matchCase: true startingAt: 1. returns Interval(1 2 3 4 5 6 7 8 9 ) but 'dummy.txt.txt' indexOf: 'dumm*.txt' matchCase: true startingAt: 1. also returns Interval(1 2 3 4 5 6 7 8 9 ) Thus in the current *nix VAST, the file name dummy.txt matches dumm*.txt, but dummy.txt.txt doesn't. Doug Swartz Tuesday, June 12, 2012, 8:49:17 AM, you wrote: > Hi again, > I'm seeing differences between Windows and Linux in CfsDirectoryDescriptor. > I need to search for and list all existing files named "fadat*.txt" > in a directory. The files are there. > On windows, the pattern 'fadat*.txt' brings up a list of files. On > Linux, it doesn't. Changing the pattern to 'fadat*' brings up the > list I'd expect (apart from the fact that .xls or .zip also are included in the list). > Is that a bug or expected behavior? The ls command on linux can handle fadat*.txt... > Here's the code I am using: > collection := OrderedCollection new. > (dd := CfsDirectoryDescriptor > opendir: self currentDirectory > pattern: 'fadat*.txt' > mode: FREG | FDIR) isCfsError > ifTrue: [self error: dd message]. > [(de := dd readdir) notNil] whileTrue: [collection add: de]. > dd closedir. > collection inspect > Thanks for reading > Joachim -- Best regards, Douglas mailto:[hidden email] -- You received this message because you are subscribed to the Google Groups "VA Smalltalk" group. To post to this group, send email to [hidden email]. To unsubscribe from this group, send email to [hidden email]. For more options, visit this group at http://groups.google.com/group/va-smalltalk?hl=en. |
Doug,
funnily, the files we need to handle often end in *.txt.txt for some strange reasons. We get them from an external source so we cannot do anything about the strange naming. So this is an (old) bug in String matching rather than in Cfs. Interesting... Has anyone at Instantiations had a chance to look into this? Joachim Am Mittwoch, 13. Juni 2012 14:26:27 UTC+2 schrieb dswartz: Hello Joachim, You received this message because you are subscribed to the Google Groups "VA Smalltalk" group. To view this discussion on the web visit https://groups.google.com/d/msg/va-smalltalk/-/HJdUoawGcxMJ. To post to this group, send email to [hidden email]. To unsubscribe from this group, send email to [hidden email]. For more options, visit this group at http://groups.google.com/group/va-smalltalk?hl=en. |
Free forum by Nabble | Edit this page |