diff options
| author | lukeflo | 2025-06-01 14:54:38 +0200 |
|---|---|---|
| committer | lukeflo | 2025-06-01 14:54:38 +0200 |
| commit | d64596242ab185fffebc773ad2dcb5f1be2fccc2 (patch) | |
| tree | 63c63e0d012b07ce66153ffba9dc7b13ebee0124 /src/app.rs | |
| parent | 62580d8cc537808c34b0d9a0fe5554b4806a7aa6 (diff) | |
| download | bibiman-d64596242ab185fffebc773ad2dcb5f1be2fccc2.tar.gz bibiman-d64596242ab185fffebc773ad2dcb5f1be2fccc2.zip | |
some fixes and test for `file_prefix` with new bool
Diffstat (limited to 'src/app.rs')
| -rw-r--r-- | src/app.rs | 27 |
1 files changed, 20 insertions, 7 deletions
@@ -350,7 +350,19 @@ impl App { entry.filepath.unwrap().iter().for_each(|p| { items.push(( "File (PDF/EPUB): ".into(), - p.clone().into_string().unwrap(), + // p.clone().into_string().unwrap(), + if entry.file_field && cfg.general.file_prefix.is_some() { + cfg.general + .file_prefix + .clone() + .unwrap() + .join(p) + .into_os_string() + .into_string() + .unwrap() + } else { + p.clone().into_string().unwrap() + }, )) }); } @@ -360,7 +372,7 @@ impl App { } else { self.bibiman.open_popup( PopupKind::MessageError, - Some("Selected entry has no connected ressources: "), + Some("Selected entry has no connected resources: "), Some(&entry.citekey), None, )?; @@ -389,11 +401,12 @@ pub fn open_connected_file(cfg: &BibiConfig, file: &OsStr) -> Result<()> { // Build command to execute pdf-reader. 'xdg-open' is Linux standard let cmd = &cfg.general.pdf_opener; // If necessary, replace ~ with /home dir - let file = if cfg.general.file_prefix.is_some() { - cfg.general.file_prefix.clone().unwrap().join(file) - } else { - PathBuf::from(file) - }; + // let file = if cfg.general.file_prefix.is_some() { + // cfg.general.file_prefix.clone().unwrap().join(file) + // } else { + // PathBuf::from(file) + // }; + let file = PathBuf::from(file); let file = expand_home(&file).into_os_string(); |
