-
-
Notifications
You must be signed in to change notification settings - Fork 2.7k
Add fs::try_exists
#4299
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 fs::try_exists
#4299
Conversation
Let's wait for std to stabilize |
|
Sure! I see that it hasn't been released yet, but I would be happy to include our own version of it when that happens. |
Unless I'm misunderstanding looks like Would you folks find it helpful if I contributed a version using |
Well, the documentation for |
Didn't realize there are more updates on this PR after 2 years. I can still update this PR to make it work with the latest Tokio version once the API is stablized. |
Ah, I see. It's been stabilized as |
0ddf5fc
to
ec6bc2c
Compare
It seems that minrust is installing Rust 1.49.0 which is too hold for the feature? (at 1.63.0, already >= 6 months old) Can I update it in the ci.yml file? |
As an outside contributor, I would personally consider that to be a breaking change and vote for something that will work with Rust 1.49, if possible. From a quick search I found this: https://stackoverflow.com/questions/32384594/how-to-check-whether-a-path-exists But some may not agree with me. See https://doc.rust-lang.org/cargo/reference/semver.html#env-new-rust |
The was actually originally used in the implementation (before my recent sync). I can consider reverting it back if deemed better to use fs::metadata |
Ah, yes, we need to use an implementation that will work on 1.49. Sorry if that was unclear. My main concern was matching the API in std, but it turns out that they have chosen an API we cannot match, so I am ok with moving forward with an |
Updated implementation to use the exact fs::try_exists impl from std |
a69869f
to
f8bb8a9
Compare
Another outsider comment I would kinda favor adding a comment with this info. P.S. +1 on the explanatory comment added thanks! |
Looks great! Thanks so much! |
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.
Thanks.
🙌🏻 |
Motivation
std
has addedPath::exists
and (unstable)fs::try_exists
. Addingtry_exists
totokio::fs
based on prior discussions in #3375 (which has not been updated for a while)Solution
Add
fs::try_exists
function.Fixes: #3373