Canonicalize paths when opening workspaces (#21039)

Closes #17161

Release Notes:

- Added symlink resolution when opening projects from within Zed.
Previously this only happened within zed's cli, but that broke file
watching on Linux when opening a symlinked directory.
This commit is contained in:
Conrad Irwin 2024-11-22 09:20:49 -07:00 committed by GitHub
parent d489f96aef
commit 852fb51528
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -1096,10 +1096,17 @@ impl Workspace {
);
cx.spawn(|mut cx| async move {
let serialized_workspace: Option<SerializedWorkspace> =
persistence::DB.workspace_for_roots(abs_paths.as_slice());
let mut paths_to_open = Vec::with_capacity(abs_paths.len());
for path in abs_paths.into_iter() {
if let Some(canonical) = app_state.fs.canonicalize(&path).await.ok() {
paths_to_open.push(canonical)
} else {
paths_to_open.push(path)
}
}
let mut paths_to_open = abs_paths;
let serialized_workspace: Option<SerializedWorkspace> =
persistence::DB.workspace_for_roots(paths_to_open.as_slice());
let workspace_location = serialized_workspace
.as_ref()