From a21f2e071976ae4b522d089272269fd202f1ab68 Mon Sep 17 00:00:00 2001 From: Paul Campbell Date: Fri, 4 Aug 2023 19:43:50 +0100 Subject: [PATCH] history file opens file or fails --- src/history/find.rs | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/src/history/find.rs b/src/history/find.rs index bb6cdc2..b413925 100644 --- a/src/history/find.rs +++ b/src/history/find.rs @@ -5,12 +5,15 @@ use std::io::{BufRead, BufReader}; use super::Link; pub fn find(link: &Link, file_name: &str, e: &FileEnv) -> Result { - if let Ok(file) = (e.open)(file_name) { - let reader = BufReader::new(file); - for line in reader.lines() { - if line? == link.href { - return Ok(true); // is already downloaded - } + println!("Opening file: {file_name}"); + let file = (e.open)(file_name)?; + println!("Opened file: {file_name}"); + let reader = BufReader::new(file); + for line in reader.lines() { + let line = line?; + if line == link.href { + println!("history: {}", line); + return Ok(true); // is already downloaded } } Ok(false) // is not already downloaded