diff --git a/crates/project_panel/src/project_panel.rs b/crates/project_panel/src/project_panel.rs index 57a45ddb169c469cc817e2d9cb848ae8832c01ab..fe8c6494202286e8f43f802dd9320315ecaf950e 100644 --- a/crates/project_panel/src/project_panel.rs +++ b/crates/project_panel/src/project_panel.rs @@ -547,7 +547,7 @@ impl ProjectPanel { worktree_id, entry_id: NEW_ENTRY_ID, }); - let new_path = entry.path.join(&filename); + let new_path = entry.path.join(&filename.trim_start_matches("/")); if path_already_exists(new_path.as_path()) { return None; } @@ -2111,7 +2111,7 @@ mod tests { let confirm = panel.update(cx, |panel, cx| { panel.filename_editor.update(cx, |editor, cx| { - editor.set_text("bdir1/dir2/the-new-filename", cx) + editor.set_text("/bdir1/dir2/the-new-filename", cx) }); panel.confirm(&Confirm, cx).unwrap() }); @@ -2124,7 +2124,7 @@ mod tests { " > a", " > b", " > C", - " [PROCESSING: 'bdir1/dir2/the-new-filename'] <== selected", + " [PROCESSING: '/bdir1/dir2/the-new-filename'] <== selected", " .dockerignore", "v root2", " > d",