Undo a refactor of buffer_path_log_err
(#27828)
Accidentally included this in #27822 Release Notes: - N/A
This commit is contained in:
parent
8075c2458f
commit
5343f1cdaf
1 changed files with 5 additions and 9 deletions
|
@ -633,21 +633,17 @@ fn collect_buffer_info_and_text(
|
|||
|
||||
pub fn buffer_path_log_err(buffer: &Buffer, cx: &App) -> Option<Arc<Path>> {
|
||||
if let Some(file) = buffer.file() {
|
||||
Some(file_path(file, cx))
|
||||
let mut path = file.path().clone();
|
||||
if path.as_os_str().is_empty() {
|
||||
path = file.full_path(cx).into();
|
||||
}
|
||||
Some(path)
|
||||
} else {
|
||||
log::error!("Buffer that had a path unexpectedly no longer has a path.");
|
||||
None
|
||||
}
|
||||
}
|
||||
|
||||
pub fn file_path(file: &Arc<dyn File>, cx: &App) -> Arc<Path> {
|
||||
let mut path = file.path().clone();
|
||||
if path.as_os_str().is_empty() {
|
||||
path = file.full_path(cx).into();
|
||||
}
|
||||
return path;
|
||||
}
|
||||
|
||||
fn to_fenced_codeblock(path: &Path, content: Rope) -> SharedString {
|
||||
let path_extension = path.extension().and_then(|ext| ext.to_str());
|
||||
let path_string = path.to_string_lossy();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue