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
@@ -915,7 +915,7 @@ impl WorkspaceDb {
relative_worktree_path == String::default()
);
let Some(relative_path) = RelPath::new(&relative_worktree_path).log_err() else {
let Some(relative_path) = RelPath::unix(&relative_worktree_path).log_err() else {
continue;
};
if worktree_id != u64::MAX && relative_worktree_path != String::default() {
@@ -1001,7 +1001,7 @@ impl WorkspaceDb {
for toolchain in toolchains {
let query = sql!(INSERT OR REPLACE INTO user_toolchains(remote_connection_id, workspace_id, worktree_id, relative_worktree_path, language_name, name, path, raw_json) VALUES (?1, ?2, ?3, ?4, ?5, ?6, ?7, ?8));
let (workspace_id, worktree_id, relative_worktree_path) = match scope {
ToolchainScope::Subproject(worktree_id, ref path) => (Some(workspace.id), Some(worktree_id), Some(path.as_str().to_owned())),
ToolchainScope::Subproject(worktree_id, ref path) => (Some(workspace.id), Some(worktree_id), Some(path.as_unix_str().to_owned())),
ToolchainScope::Project => (Some(workspace.id), None, None),
ToolchainScope::Global => (None, None, None),
};
@@ -1661,7 +1661,7 @@ impl WorkspaceDb {
workspace_id,
language_name.as_ref().to_string(),
worktree_id.to_usize(),
relative_worktree_path.as_str().to_string(),
relative_worktree_path.as_unix_str().to_string(),
))?;
Ok(toolchain
@@ -1743,7 +1743,7 @@ impl WorkspaceDb {
insert((
workspace_id,
worktree_id.to_usize(),
relative_worktree_path.as_str(),
relative_worktree_path.as_unix_str(),
toolchain.language_name.as_ref(),
toolchain.name.as_ref(),
toolchain.path.as_ref(),