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:
@@ -4628,12 +4628,12 @@ impl BufferSnapshot {
|
||||
self.file.as_ref()
|
||||
}
|
||||
|
||||
pub fn resolve_file_path(&self, cx: &App, include_root: bool) -> Option<PathBuf> {
|
||||
pub fn resolve_file_path(&self, include_root: bool, cx: &App) -> Option<String> {
|
||||
if let Some(file) = self.file() {
|
||||
if file.path().file_name().is_none() || include_root {
|
||||
Some(file.full_path(cx))
|
||||
Some(file.full_path(cx).to_string_lossy().to_string())
|
||||
} else {
|
||||
Some(file.path().as_std_path().to_owned())
|
||||
Some(file.path().display(file.path_style(cx)).to_string())
|
||||
}
|
||||
} else {
|
||||
None
|
||||
|
||||
Reference in New Issue
Block a user