aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorlukeflo2025-06-09 16:51:36 +0200
committerlukeflo2025-06-09 16:51:36 +0200
commit99349d723b48428e6e2b195dd45e8ebf04966b05 (patch)
tree21bf2da752fc477eda96c1eb58c229d417326742
parent36a1a8bc75b44c807c3e9613f25fe8a299e5df02 (diff)
downloadbibiman-99349d723b48428e6e2b195dd45e8ebf04966b05.tar.gz
bibiman-99349d723b48428e6e2b195dd45e8ebf04966b05.zip
Fix: fix expansion of tilde (`~`) into home dir
-rw-r--r--src/bibiman.rs7
-rw-r--r--tests/test-config.toml2
2 files changed, 4 insertions, 5 deletions
diff --git a/src/bibiman.rs b/src/bibiman.rs
index ea9dbf5..3341653 100644
--- a/src/bibiman.rs
+++ b/src/bibiman.rs
@@ -29,7 +29,6 @@ use color_eyre::eyre::{Error, Result};
use editor_command::EditorBuilder;
use ratatui::widgets::ScrollbarState;
use regex::Regex;
-use std::ffi::OsString;
use std::fs::{self, read_to_string};
use std::fs::{File, OpenOptions};
use std::io::Write;
@@ -680,15 +679,15 @@ impl Bibiman {
// TODO: Selection for multiple files
// let object = self.entry_table.entry_table_items[entry_idx].filepath()[0];
let file = expand_home(&PathBuf::from(popup_entry.clone()));
- let object: OsString = popup_entry.into();
+ // let object: OsString = popup_entry.into();
if file.is_file() {
- app::open_connected_file(cfg, &object)?;
+ app::open_connected_file(cfg, &file.into_os_string())?;
self.close_popup();
} else {
self.open_popup(
PopupKind::MessageError,
Some("No valid file path: "),
- Some(object.to_str().unwrap()),
+ Some(file.to_str().unwrap()),
None,
)?;
}
diff --git a/tests/test-config.toml b/tests/test-config.toml
index 4e4f8c5..6d05b64 100644
--- a/tests/test-config.toml
+++ b/tests/test-config.toml
@@ -19,7 +19,7 @@ file_prefix = "/some/path/prefix"
## Path to folder (with subfolders) containing PDF files with the basename
## of the format "citekey.pdf". Other PDF basenames are not accepted.
## Use absolute paths (~ for HOME works). Otherwise, loading might not work.
-pdf_path = "tests/pdf-files"
+pdf_path = "~/Documents/coding/projects/bibiman/tests/pdf-files"
# [colors]
## Default values for dark-themed terminal