-
-
Notifications
You must be signed in to change notification settings - Fork 3.8k
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
Asset IO read_directory
No Longer Panics on Absolute Path
#9478
Asset IO read_directory
No Longer Panics on Absolute Path
#9478
Conversation
Example |
Can this be done without adding another dependency crate? |
Will probably hold on this until #8624 is merged |
Absolutely! But you'd end up just copying the contents of |
If it takes 43 lines of code, I'd call that very much trivial.
So instead of small file with custom implementation somewhere inside the bevy repo, you'll have:
I'm not buying into "good open source software composition" idea. But I don't know bevy policies about introducing new dependencies, that's up to maintainers here. Also, here's a funny read on the subject I just found, contents of which you can probably guess by the title: |
Short is not the same as simple.
Bevy currently builds with just shy of 1,000 crates as dependencies depending on your project, a single addition (which itself has 0 dependencies) will make zero difference to anyone who truly believes more dependencies equals bad.
Again, Bevy is already including hundreds of dependencies each with anywhere from one to thousands of files, one dependency is not going to meaningfully change that.
See response to points one and two.
That's just not how open source dependency management works. You can't say "I'll just make my own solution and put in all the work to maintain it" and "Putting in the work to maintain someone else's version is too hard" at the same time. For this crate in particular I think that's a poor critique, since it has well over 15 million downloads and only 3 versions in its entire lifetime.
That's only an issue if you expose types from a third party library as your own, which is not happening in this case. And even then, you can still manage this.
See response to points 1.
The idea is to minimize double work. This pull request "implements 43 lines of code in 1" thanks to the generous work of the maintainers of
This is not comparable. The leftpad controversy largely stems from the fact that there is a native solution to that problem already. There is no I appreciate the criticism, and I'm also new to contributing to Bevy, so I am absolutely open to being told this is a bad fit for Bevy. In my opinion, this is the best solution to this problem, which is why I wrote it an submitted it. If you believe you have a better solution, please make a PR and submit it. Either way, Bevy and its community wins. |
okay, sure, here we go: #9490 |
Co-authored-by: Félix Lescaudey de Maneville <felix.maneville@gmail.com>
The closure in `unwrap_or_else` must not accept arguments, and the panic message can't include the paths due to movement into `diff_paths`
Example |
The linked bug is now fixed: should I close this out? |
Objective
Solution
pathdiff::diff_paths
to explicitly create the desired path, which handles the edge case where a provided path is actually an absolute path already, and thus cannot be stripped of a prefix of the general root path for the Asset IO.Changelog
pathdiff
crate tobevy_asset
to allow for the creation of relative paths in a platform agnostic manner.read_directory
incorrectly assuminga.join(b).strip_prefix(a) == Ok(b)