From 99349d723b48428e6e2b195dd45e8ebf04966b05 Mon Sep 17 00:00:00 2001 From: lukeflo Date: Mon, 9 Jun 2025 16:51:36 +0200 Subject: Fix: fix expansion of tilde (`~`) into home dir --- src/bibiman.rs | 7 +++---- tests/test-config.toml | 2 +- 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 -- cgit v1.2.3