Skip to content

Commit f8bd514

Browse files
super-saturnjpbloomalice-i-cecile
authored andcommitted
Fix path checking for FileWatcher for virtual workspace projects (#16958)
# Objective Fixes #16879 ## Solution Moved the construction of the root path of the assets folder out of `FileWatcher::new()` and into `source.rs`, as the path is checked there with `path.exists()` and fails in certain configurations eg., virtual workspaces. ## Testing Applied fix to a private fork and tested against both standard project setups and virtual workspaces. Works without issue on both. Have tested under macOS and Arch Linux. --------- Co-authored-by: JP Stringham <[email protected]> Co-authored-by: Alice Cecile <[email protected]>
1 parent e6256e7 commit f8bd514

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

crates/bevy_asset/src/io/file/file_watcher.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,13 +26,13 @@ pub struct FileWatcher {
2626

2727
impl FileWatcher {
2828
pub fn new(
29-
root: PathBuf,
29+
path: PathBuf,
3030
sender: Sender<AssetSourceEvent>,
3131
debounce_wait_time: Duration,
3232
) -> Result<Self, notify::Error> {
33-
let root = normalize_path(super::get_base_path().join(root).as_path());
33+
let root = normalize_path(&path);
3434
let watcher = new_asset_event_debouncer(
35-
root.clone(),
35+
path.clone(),
3636
debounce_wait_time,
3737
FileEventHandler {
3838
root,

crates/bevy_asset/src/io/source.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -531,7 +531,7 @@ impl AssetSource {
531531
not(target_os = "android")
532532
))]
533533
{
534-
let path = std::path::PathBuf::from(path.clone());
534+
let path = super::file::get_base_path().join(path.clone());
535535
if path.exists() {
536536
Some(Box::new(
537537
super::file::FileWatcher::new(

0 commit comments

Comments
 (0)