1
Fork 0

Replace Session should_remap_filepaths with filename_display_preference

This commit is contained in:
Urgau 2024-03-22 15:27:17 +01:00
parent 4f4fa42b0e
commit fefb8f1f9c
6 changed files with 48 additions and 50 deletions

View file

@ -271,6 +271,18 @@ impl RealFileName {
}
}
/// Return the path remmapped or not depending on the [`FileNameDisplayPreference`].
///
/// For the purpose of this function, local and short preference are equal.
pub fn to_path(&self, display_pref: FileNameDisplayPreference) -> &Path {
match display_pref {
FileNameDisplayPreference::Local | FileNameDisplayPreference::Short => {
self.local_path_if_available()
}
FileNameDisplayPreference::Remapped => self.remapped_path_if_available(),
}
}
pub fn to_string_lossy(&self, display_pref: FileNameDisplayPreference) -> Cow<'_, str> {
match display_pref {
FileNameDisplayPreference::Local => self.local_path_if_available().to_string_lossy(),