Clean up RelPath API (#38912)

Consolidate constructors and accessors.

Release Notes:

- N/A

---------

Co-authored-by: Cole Miller <cole@zed.dev>
This commit is contained in:
Max Brunsfeld
2025-09-25 14:42:32 -07:00
committed by GitHub
co-authored by Cole Miller
parent 301e976465
commit 495a7b0a84
70 changed files with 483 additions and 408 deletions
+4 -4
View File
@@ -128,7 +128,7 @@ impl CommitView {
let mut metadata_buffer_id = None;
if let Some(worktree_id) = first_worktree_id {
let file = Arc::new(CommitMetadataFile {
title: RelPath::new(&format!("commit {}", commit.sha))
title: RelPath::unix(&format!("commit {}", commit.sha))
.unwrap()
.into(),
worktree_id,
@@ -145,7 +145,7 @@ impl CommitView {
});
multibuffer.update(cx, |multibuffer, cx| {
multibuffer.set_excerpts_for_path(
PathKey::namespaced(COMMIT_METADATA_NAMESPACE, file.title.as_str().into()),
PathKey::namespaced(COMMIT_METADATA_NAMESPACE, file.title.as_unix_str().into()),
buffer.clone(),
vec![Point::zero()..buffer.read(cx).max_point()],
0,
@@ -193,7 +193,7 @@ impl CommitView {
.collect::<Vec<_>>();
let path = snapshot.file().unwrap().path().clone();
let _is_newly_added = multibuffer.set_excerpts_for_path(
PathKey::namespaced(FILE_NAMESPACE, path.as_str().into()),
PathKey::namespaced(FILE_NAMESPACE, path.as_unix_str().into()),
buffer,
diff_hunk_ranges,
multibuffer_context_lines(cx),
@@ -275,7 +275,7 @@ impl language::File for CommitMetadataFile {
}
fn full_path(&self, _: &App) -> PathBuf {
PathBuf::from(self.title.as_str().to_owned())
PathBuf::from(self.title.as_unix_str().to_owned())
}
fn file_name<'a>(&'a self, _: &'a App) -> &'a str {