diff --git a/src/history.rs b/src/history.rs index a3a85c7..28fb9e4 100644 --- a/src/history.rs +++ b/src/history.rs @@ -58,9 +58,8 @@ pub fn as_raw_menu() -> String { // save a single history entry if the history file exists pub fn save(label: &str, url: &str) -> Result<()> { - let file = format!("{}{}", config::DIR, HISTORY_FILE); - if !std::path::Path::new(&file).exists() { - return Err(error!("History file doesn't exist: {}", file)); + if let Err(e) = config::path() { + return Err(error!("History file doesn't exist: {}", e)); } config::append(HISTORY_FILE, label, url) diff --git a/src/menu.rs b/src/menu.rs index 4f8a24b..1a24654 100644 --- a/src/menu.rs +++ b/src/menu.rs @@ -486,7 +486,7 @@ impl Menu { if host != "help" { let hurl = url.to_string(); let hname = line.name.clone(); - thread::spawn(move || history::save(&hurl, &hname)); + thread::spawn(move || history::save(&hname, &hurl)); Action::Open(url) } else { Action::None