-
-
Notifications
You must be signed in to change notification settings - Fork 9.6k
[Filesystem] Improve exists() behaviour to be able to differentiate files/dirs #34037
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
What about not having this implemented as options to be passed to the |
I'm closing because |
The current implementation of Filesystem::exists allowed to check whether a file is present on the filesystem, without any kind of distinction on the file type, so it is blind about the fact that it can be a file, directory, symlink, socket, ...
The new (optional) second argument allows to specify whether we want to check against a specific file type. I used the standard Unix/POSIX file types definition (see https://en.wikipedia.org/wiki/Unix_file_types), and implemented regular/directory. Class constants were added to list/use the available file types.
The change is BC and didn't alter the default/previous behaviour. I already pushed a usage example in the associated documentation.