mirror of
https://github.com/bevyengine/bevy
synced 2024-11-10 07:04:33 +00:00
don't ignore some EventKind::Modify (#9767)
# Objective - File modification don't trigger hot reload on macOS ## Solution - [`EventKind::Modify`](https://docs.rs/notify/latest/notify/event/enum.EventKind.html#variant.Modify) can have several reasons - [`ModifyKind::Any`](https://docs.rs/notify/latest/notify/event/enum.ModifyKind.html) was used to react to change events, and later ModifyKind::Name for file name change. It left other variants of change ignored (`Data`, `Metadata`, `Other`) - move the modification handling after the rename so that it handles all other variants
This commit is contained in:
parent
8fa500d016
commit
72b8f47780
1 changed files with 11 additions and 11 deletions
|
@ -46,17 +46,6 @@ impl FileWatcher {
|
|||
let (path, _) = get_asset_path(&owned_root, &event.paths[0]);
|
||||
sender.send(AssetSourceEvent::AddedFolder(path)).unwrap();
|
||||
}
|
||||
notify::EventKind::Modify(ModifyKind::Any) => {
|
||||
let (path, is_meta) =
|
||||
get_asset_path(&owned_root, &event.paths[0]);
|
||||
if event.paths[0].is_dir() {
|
||||
// modified folder means nothing in this case
|
||||
} else if is_meta {
|
||||
sender.send(AssetSourceEvent::ModifiedMeta(path)).unwrap();
|
||||
} else {
|
||||
sender.send(AssetSourceEvent::ModifiedAsset(path)).unwrap();
|
||||
};
|
||||
}
|
||||
notify::EventKind::Access(AccessKind::Close(AccessMode::Write)) => {
|
||||
let (path, is_meta) =
|
||||
get_asset_path(&owned_root, &event.paths[0]);
|
||||
|
@ -134,6 +123,17 @@ impl FileWatcher {
|
|||
}
|
||||
}
|
||||
}
|
||||
notify::EventKind::Modify(_) => {
|
||||
let (path, is_meta) =
|
||||
get_asset_path(&owned_root, &event.paths[0]);
|
||||
if event.paths[0].is_dir() {
|
||||
// modified folder means nothing in this case
|
||||
} else if is_meta {
|
||||
sender.send(AssetSourceEvent::ModifiedMeta(path)).unwrap();
|
||||
} else {
|
||||
sender.send(AssetSourceEvent::ModifiedAsset(path)).unwrap();
|
||||
};
|
||||
}
|
||||
notify::EventKind::Remove(RemoveKind::File) => {
|
||||
let (path, is_meta) =
|
||||
get_asset_path(&owned_root, &event.paths[0]);
|
||||
|
|
Loading…
Reference in a new issue