mirror of
https://github.com/zed-industries/zed.git
synced 2025-01-27 12:54:42 +00:00
Fix picker new_path_prompt throwing "file exists" when saving (#21080)
Fix for getting File exists "os error 17" with `"use_system_path_prompts": false,` This was reproducible when the first worktree is a non-folder worktree (e.g. setting.json) so we were trying to create the new file with a path under ~/.config/zed/settings.json/newfile.ext Co-authored-by: Conrad Irwin <conrad@zed.dev>
This commit is contained in:
parent
2fd210bc9a
commit
1a0a8a9559
1 changed files with 9 additions and 1 deletions
|
@ -71,8 +71,16 @@ impl Match {
|
||||||
fn project_path(&self, project: &Project, cx: &WindowContext) -> Option<ProjectPath> {
|
fn project_path(&self, project: &Project, cx: &WindowContext) -> Option<ProjectPath> {
|
||||||
let worktree_id = if let Some(path_match) = &self.path_match {
|
let worktree_id = if let Some(path_match) = &self.path_match {
|
||||||
WorktreeId::from_usize(path_match.worktree_id)
|
WorktreeId::from_usize(path_match.worktree_id)
|
||||||
|
} else if let Some(worktree) = project.visible_worktrees(cx).find(|worktree| {
|
||||||
|
worktree
|
||||||
|
.read(cx)
|
||||||
|
.root_entry()
|
||||||
|
.is_some_and(|entry| entry.is_dir())
|
||||||
|
}) {
|
||||||
|
worktree.read(cx).id()
|
||||||
} else {
|
} else {
|
||||||
project.worktrees(cx).next()?.read(cx).id()
|
// todo(): we should find_or_create a workspace.
|
||||||
|
return None;
|
||||||
};
|
};
|
||||||
|
|
||||||
let path = PathBuf::from(self.relative_path());
|
let path = PathBuf::from(self.relative_path());
|
||||||
|
|
Loading…
Reference in a new issue