#childrenMatching: vs #allChildrenMatching:
I'm running Pharo 15.0.0 Build information: Pharo-15.0.0+SNAPSHOT.build.51.sha.25118f93922acbda429e7badccf428eaf4fa245e (64 Bit) 19 October 2026 but the same issue was present in Pharo 12.0.0 Build information: Pharo-12.0.0+SNAPSHOT.build.1557.sha.bc44933c0d2c71cd2ead19629b900c3699978de0 (64 Bit) Consider the two queries (1) FileSystem workingDirectory childrenMatching: '*.ston;*.source' (2) FileSystem workingDirectory allChildrenMatching: '*.ston;*.source' executed in the initial directory. I expected that every file found by (1) would also be found by (2). But (1) reports meta-info.ston and Pharo15...sources (2) reports NO matches. Looking at AbstractFileReference, where these methods are defined, it turns out that {children,directories,files}Matching: have an argument called 'patterns' that is a string containing many patterns separated by semicolons. '*.ston;*.sources' means "ends with .ston or ends with .sources". Fine, although that makes it tricky to require a WSL2/Ubuntu file to have a semicolon in it. But all{Children,Directories,Files}Matching: have an argument called 'pattern' that is a string containing ONE pattern with semicolons not doing anything special. '*.ston;*.sources' requires the file name, amongst other things, to contain a literal semicolon. Is this discrepancy deliberate? If so, what is the reason for it? If it is not deliberate, the least damaging fix might be to make #{children,directories,files}Matching: accept multipatterns too. The *cleanest* fix would be to require multipatterns to be written as arrays of simple patterns, but that might break existing code.
participants (1)
-
Richard O'Keefe