Make asset watcher work when path contains "../" (#18023)
# Objective Fixes #18022 ## Solution Canonicalize asset paths ## Testing I ran the examples `sprite`, `desk_toy` and `game_menu` with the feature `file_watcher` enabled. All correctly updated an asset when the source file was altered. Co-authored-by: Threadzless <threadzless@gmail.com>
This commit is contained in:
parent
ef9b898c2d
commit
1ef334cc25
@ -262,7 +262,8 @@ impl FilesystemEventHandler for FileEventHandler {
|
|||||||
self.last_event = None;
|
self.last_event = None;
|
||||||
}
|
}
|
||||||
fn get_path(&self, absolute_path: &Path) -> Option<(PathBuf, bool)> {
|
fn get_path(&self, absolute_path: &Path) -> Option<(PathBuf, bool)> {
|
||||||
Some(get_asset_path(&self.root, absolute_path))
|
let absolute_path = absolute_path.canonicalize().unwrap();
|
||||||
|
Some(get_asset_path(&self.root, &absolute_path))
|
||||||
}
|
}
|
||||||
|
|
||||||
fn handle(&mut self, _absolute_paths: &[PathBuf], event: AssetSourceEvent) {
|
fn handle(&mut self, _absolute_paths: &[PathBuf], event: AssetSourceEvent) {
|
||||||
|
Loading…
Reference in New Issue
Block a user