Skip to content

Commit

Permalink
feat: Warn when file does not look legit
Browse files Browse the repository at this point in the history
  • Loading branch information
alexpovel committed Oct 27, 2023
1 parent e03c110 commit 1593ec7
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion src/main.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
use anyhow::Context;
use anyhow::Result;
use log::{debug, error, info, LevelFilter};
use log::{debug, error, info, warn, LevelFilter};
use rayon::prelude::*;
use srgn::actions::Deletion;
#[cfg(feature = "german")]
Expand Down Expand Up @@ -65,6 +65,14 @@ fn main() -> Result<()> {
let path = glob.context("Failed to glob")?;
debug!("Processing path: {:?}", path);

if !path.is_file() {
warn!(
"Path does not look like a file (will still try): '{}' (Metadata: {:?})",
path.display(),
path.metadata()
);
}

let contents = {
let file = File::open(&path)
.with_context(|| format!("Failed to read file: {:?}", path))?;
Expand Down

0 comments on commit 1593ec7

Please sign in to comment.