propertiesView: Retrive host path via portal

This way we should always be able to get the correct folder name if
xdg-desktop-portal > 0.19.
This commit is contained in:
Sophie Herold 2024-10-08 20:53:10 +02:00
parent c38430e292
commit fa46c76af4
6 changed files with 27 additions and 8 deletions

View file

@ -24,6 +24,9 @@
mod file;
mod gps;
use std::path::PathBuf;
use std::str::FromStr;
pub use file::FileInfo;
use glycin::{Frame, FrameDetails, ImageInfoDetails, MemoryFormat};
pub use gps::GPSLocation;
@ -191,6 +194,14 @@ impl Metadata {
self.file_info.as_ref().map(|x| x.display_name.to_string())
}
/// Original host path inside flatpaks obtained via xattr
pub fn host_path(&self) -> Option<PathBuf> {
self.file_info
.as_ref()
.and_then(|x| x.host_path.as_ref())
.and_then(|x| PathBuf::from_str(x.as_str()).ok())
}
pub fn file_size(&self) -> Option<String> {
self.file_info
.as_ref()