-
-
Notifications
You must be signed in to change notification settings - Fork 42
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
Add method to FileSystem to check for file existance #237
Conversation
To be able to check if file exists using simple function instead of Fiber.try
To check if the file exists it attempts to open the file if it fails the file either doesn't exist or the program does not have the permission to read it.
if ENGINE_readfile and if it fails the file doesn't exist.
to the FileSystem class in IO
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you for the contribution. It isn't quite where I'd like it for merging, but it definitely gets close.
Documentation for the new method will also be required before I can merge this.
I accidentally put these on the main branch first read there
I accidentally put these on the main branch first read there
I accidentally put these on the main branch first read there
I accidentally put these on the main branch first read there
Oops accidentally committed the changes to the wrong branch again. Fixing that! |
Change to reduce code in FILESYSTEM_doesFileExist and change FILESYSTEM_doesDirectoryExist to return A boolean.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There's a few final changes to make, but I'm happier with how this looks, at least from the API design side.
Please also add yourself to the AUTHORS file, so you can be appropriately credited :)
ENGINE_directoryExists now returns A boolean. Duplicate code is removed and replaced by function calls.
Changed it to type dirCheck as boolean. And now directly uses wrenSetSlotBool
Thank you so much for this contribution (and putting up with my review process!) |
I saw in the discord server someone was asking about this and though it was A simple enough feature to implement. So I did. The new method is called fileExists in the class FileSystem. It returns true if the file exists and false it not.