-
-
Notifications
You must be signed in to change notification settings - Fork 3.9k
Move away from std::Path in bevy_assets #19133
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
Open
lielfr
wants to merge
9
commits into
bevyengine:main
Choose a base branch
from
lielfr:asset-path-nostd
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+154
−61
Open
Changes from all commits
Commits
Show all changes
9 commits
Select commit
Hold shift + click to select a range
2a4435e
change AssetPath to use &str
lielfr 9531004
remove more usages of PathBuf
lielfr 8e8903d
cleanup
lielfr 3073d77
fix lints
lielfr 7ec7345
get rid of unused function and use string version instead
lielfr 6638211
remove itertools unused dependency
lielfr 399d813
fix build in embedded_watcher
lielfr d7c06fb
remove lossy conversions, fix linting and doc tests, add more tests f…
lielfr 2a4df37
PR fixes - constants for path separator, UTF-8 instead of unicode for…
lielfr File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
I believe this canonicalize is important here. It makes paths with dots work correctly
"../../my_assets_dir"
. Relevant PR: #18345 (hey look its me! I forgot all about this lol)Should FileWatcher even be dealing with asset paths? This seems like a case where a file system path actually does make sense? I'm not sure though.
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.
I'm not familiar enough (yet?) with the codebase to decide, so I'd love some guidance here
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.
I think we would have to roll out own version of canonicalize to maintain being able to use ".." for relative paths
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.
I looked into this a bit more, and I'm doubling down: I think FileWatcher should continue to deal with
Path
directly. I think the main thing we want to replace is the fact that our asset paths (as in, the ones that we pass intoasset_server.load()
) include some platform specific nonsense. That does not mean that our entire stack needs to deal only with strings - at some point, we need to convert that asset path into a concrete file path, so aPath
instance.So coming at it from the other angle,
FileWatcher
should be dealing with concrete paths because it is listening for real file system events for a particular directory. So I think we should revert what's happening in thisfile_watcher
mod.Uh oh!
There was an error while loading. Please reload this page.
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.
The plan that cart and I discussed a couple of years ago:
AssetPath::resolve
shouldn't use FilePath methods.