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
+7 -7
View File
@@ -31,12 +31,12 @@ static CONFIG_DIR: OnceLock<PathBuf> = OnceLock::new();
/// Returns the relative path to the zed_server directory on the ssh host.
pub fn remote_server_dir_relative() -> &'static RelPath {
RelPath::new(".zed_server").unwrap()
RelPath::unix(".zed_server").unwrap()
}
/// Returns the relative path to the zed_wsl_server directory on the wsl host.
pub fn remote_wsl_server_dir_relative() -> &'static RelPath {
RelPath::new(".zed_wsl_server").unwrap()
RelPath::unix(".zed_wsl_server").unwrap()
}
/// Sets a custom directory for all user data, overriding the default data directory.
@@ -410,17 +410,17 @@ pub fn local_vscode_folder_name() -> &'static str {
/// Returns the relative path to a `settings.json` file within a project.
pub fn local_settings_file_relative_path() -> &'static RelPath {
RelPath::new(".zed/settings.json").unwrap()
RelPath::unix(".zed/settings.json").unwrap()
}
/// Returns the relative path to a `tasks.json` file within a project.
pub fn local_tasks_file_relative_path() -> &'static RelPath {
RelPath::new(".zed/tasks.json").unwrap()
RelPath::unix(".zed/tasks.json").unwrap()
}
/// Returns the relative path to a `.vscode/tasks.json` file within a project.
pub fn local_vscode_tasks_file_relative_path() -> &'static RelPath {
RelPath::new(".vscode/tasks.json").unwrap()
RelPath::unix(".vscode/tasks.json").unwrap()
}
pub fn debug_task_file_name() -> &'static str {
@@ -434,12 +434,12 @@ pub fn task_file_name() -> &'static str {
/// Returns the relative path to a `debug.json` file within a project.
/// .zed/debug.json
pub fn local_debug_file_relative_path() -> &'static RelPath {
RelPath::new(".zed/debug.json").unwrap()
RelPath::unix(".zed/debug.json").unwrap()
}
/// Returns the relative path to a `.vscode/launch.json` file within a project.
pub fn local_vscode_launch_file_relative_path() -> &'static RelPath {
RelPath::new(".vscode/launch.json").unwrap()
RelPath::unix(".vscode/launch.json").unwrap()
}
pub fn user_ssh_config_file() -> PathBuf {