aboutsummaryrefslogtreecommitdiff
path: root/src/bibiman.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/bibiman.rs')
-rw-r--r--src/bibiman.rs16
1 files changed, 14 insertions, 2 deletions
diff --git a/src/bibiman.rs b/src/bibiman.rs
index 583d849..ea9dbf5 100644
--- a/src/bibiman.rs
+++ b/src/bibiman.rs
@@ -15,6 +15,7 @@
// along with this program. If not, see <https://www.gnu.org/licenses/>.
/////
+use crate::app::expand_home;
use crate::bibiman::entries::EntryTableColumn;
use crate::bibiman::{bibisetup::*, search::BibiSearch};
use crate::cliargs::CLIArgs;
@@ -674,16 +675,27 @@ impl Bibiman {
let object = self.entry_table.entry_table_items[entry_idx].doi_url();
let url = app::prepare_weblink(object);
app::open_connected_link(cfg, &url)?;
+ self.close_popup();
} else if self.popup_area.popup_list[popup_idx].0.contains("File") {
// 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();
- app::open_connected_file(cfg, &object)?;
+ if file.is_file() {
+ app::open_connected_file(cfg, &object)?;
+ self.close_popup();
+ } else {
+ self.open_popup(
+ PopupKind::MessageError,
+ Some("No valid file path: "),
+ Some(object.to_str().unwrap()),
+ None,
+ )?;
+ }
} else {
eprintln!("Unable to find ressource to open");
};
// run command to open file/Url
- self.close_popup();
Ok(())
}