Split out RelPath into a separate crate (#61029)
This is necessary to remove some `util` dependencies from crates, as well as better sharing for our projects. This also includes the WIP AbsPath abstraction as well as some bug fixes from internal tooling. Release Notes: - N/A or Added/Fixed/Improved ...
This commit is contained in:
1 parent
febe242c0b
commit
f181a2f47b
93 files changed
+1458
-839
No files matched your search
@@ -172,13 +172,13 @@ pub fn find_devcontainer_configs(workspace: &Workspace, cx: &gpui::App) -> Vec<D
|
||||
pub fn find_configs_in_snapshot(snapshot: &Snapshot) -> Vec<DevContainerConfig> {
|
||||
let mut configs = Vec::new();
|
||||
|
||||
let devcontainer_dir_path = RelPath::unix(".devcontainer").expect("valid path");
|
||||
let devcontainer_dir_path = RelPath::from_unix_str(".devcontainer").expect("valid path");
|
||||
|
||||
if let Some(devcontainer_entry) = snapshot.entry_for_path(devcontainer_dir_path) {
|
||||
if devcontainer_entry.is_dir() {
|
||||
log::debug!("find_configs_in_snapshot: Scanning .devcontainer directory");
|
||||
let devcontainer_json_path =
|
||||
RelPath::unix(".devcontainer/devcontainer.json").expect("valid path");
|
||||
RelPath::from_unix_str(".devcontainer/devcontainer.json").expect("valid path");
|
||||
for entry in snapshot.child_entries(devcontainer_dir_path) {
|
||||
log::debug!(
|
||||
"find_configs_in_snapshot: Found entry: {:?}, is_file: {}, is_dir: {}",
|
||||
@@ -199,7 +199,7 @@ pub fn find_configs_in_snapshot(snapshot: &Snapshot) -> Vec<DevContainerConfig>
|
||||
|
||||
let config_json_path =
|
||||
format!("{}/devcontainer.json", entry.path.as_unix_str());
|
||||
if let Ok(rel_config_path) = RelPath::unix(&config_json_path) {
|
||||
if let Ok(rel_config_path) = RelPath::from_unix_str(&config_json_path) {
|
||||
if snapshot.entry_for_path(rel_config_path).is_some() {
|
||||
log::debug!(
|
||||
"find_configs_in_snapshot: Found config in subfolder: {}",
|
||||
@@ -223,7 +223,7 @@ pub fn find_configs_in_snapshot(snapshot: &Snapshot) -> Vec<DevContainerConfig>
|
||||
|
||||
// Always include `.devcontainer.json` so the user can pick it from the UI
|
||||
// even when `.devcontainer/devcontainer.json` also exists.
|
||||
let root_config_path = RelPath::unix(".devcontainer.json").expect("valid path");
|
||||
let root_config_path = RelPath::from_unix_str(".devcontainer.json").expect("valid path");
|
||||
if snapshot
|
||||
.entry_for_path(root_config_path)
|
||||
.is_some_and(|entry| entry.is_file())
|
||||
@@ -400,7 +400,7 @@ pub(crate) async fn apply_devcontainer_template(
|
||||
log::error!("Can't create relative path: {e}");
|
||||
DevContainerError::FilesystemError
|
||||
})?;
|
||||
let rel_path = RelPath::unix(relative_path)
|
||||
let rel_path = RelPath::from_unix_str(relative_path)
|
||||
.map_err(|e| {
|
||||
log::error!("Can't create relative path: {e}");
|
||||
DevContainerError::FilesystemError
|
||||
|
||||
Reference in new issue
Block a user