windows: Fix inconsistent separators in buffer headers and breadcrumbs (#38898)
Make `resolve_full_path` use the appropriate separators, and return a `String`. As part of fixing the fallout from that type change, this also fixes a bunch of places in the agent code that were using `std::path::Path` operations on paths that could be non-local, by changing them to operate instead on strings and use the project's `PathStyle`. This clears the way a bit for making `full_path` also return a string instead of a `PathBuf`, but I've left that for a follow-up. Release Notes: - N/A
This commit is contained in:
@@ -280,6 +280,17 @@ impl PathStyle {
|
||||
))
|
||||
}
|
||||
}
|
||||
|
||||
pub fn split(self, path_like: &str) -> (Option<&str>, &str) {
|
||||
let Some(pos) = path_like.rfind(self.separator()) else {
|
||||
return (None, path_like);
|
||||
};
|
||||
let filename_start = pos + self.separator().len();
|
||||
(
|
||||
Some(&path_like[..filename_start]),
|
||||
&path_like[filename_start..],
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone)]
|
||||
|
||||
Reference in New Issue
Block a user