You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Looking at the code, it seems to be a documentation issue rather than a bug... GlobbingAliases.GetFiles accepts a Func<IFileSystemInfo, bool> and passes it to IGlobber.Match, but IGlobber.Match actually accepts a Func<IDirectory, bool>. Because of contravariance, a Func<IFileSystemInfo, bool> is a valid Func<IDirectory, bool>, but the signature of GetFiles seems to imply that the predicate will receive either files or directories, when it will actually receive only directories.
Looking at the doc, my understanding was that the predicate was a filter applied to the items found during the scan; but actually it's a filter on which directories will be scanned. The doc should be updated to make that clear.
(for my use case, what I really needed was Linq's Where method, but when I saw an overload of GetFiles with a predicate, I tried to use it instead)
What You Are Seeing?
The
GetFiles
overload with a predicate doesn't pass the file to the predicate, but its parent folder.What is Expected?
The predicate should receive the file, as specified in the documentation:
What version of Cake are you using?
Version 0.11.0+Branch.main.Sha.f67efd089db717c4e67bf0e32a9003cd90f67620
Are you running on a 32 or 64 bit system?
64bit
What environment are you running on? Windows? Linux? Mac?
Windows 8.1
Are you running on a CI Server? If so, which one?
No
The text was updated successfully, but these errors were encountered: