windows: Fix fs watch when file doesn't exist or is a symlink (#22660)

Closes #22659

More context can be found in attached issue.

This is specific to Windows:

1. Add parent directory watching for fs watch when the file doesn't
exist. For example, when Zed is first launched and `settings.json` isn't
there.
2. Add proper symlink handling for fs watch. For example, when
`settings.json` is a symlink.

This is exactly same as how we handle it on Linux.

Release Notes:

- Fixed an issue where items on the Welcome page could not be toggled on
Windows, either on first launch or when `settings.json` is a symlink.
This commit is contained in:
tims 2025-01-07 23:50:22 +05:30 committed by GitHub
parent d58f006498
commit d3fc00d5a0
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
4 changed files with 56 additions and 72 deletions

View file

@ -854,8 +854,8 @@ async fn test_write_file(cx: &mut TestAppContext) {
.await
.unwrap();
#[cfg(any(target_os = "linux", target_os = "freebsd"))]
fs::linux_watcher::global(|_| {}).unwrap();
#[cfg(not(target_os = "macos"))]
fs::fs_watcher::global(|_| {}).unwrap();
cx.read(|cx| tree.read(cx).as_local().unwrap().scan_complete())
.await;