From f715b54dcd5711bb654151d34597dd0d61617920 Mon Sep 17 00:00:00 2001 From: Avril Date: Tue, 3 Nov 2020 00:26:47 +0000 Subject: [PATCH] fix nonexistent paths --- TODO | 2 ++ src/delete.rs | 4 ---- src/main.rs | 12 +++++++++--- src/state.rs | 1 + 4 files changed, 12 insertions(+), 7 deletions(-) create mode 100644 TODO diff --git a/TODO b/TODO new file mode 100644 index 0000000..b1ea52a --- /dev/null +++ b/TODO @@ -0,0 +1,2 @@ +Add lolistealer-like async progress bar handler to State (check state.rs) + diff --git a/src/delete.rs b/src/delete.rs index e2e891c..4906a4e 100644 --- a/src/delete.rs +++ b/src/delete.rs @@ -37,10 +37,6 @@ async fn process_single(state: Arc, path: impl AsRef) -> eyr let _g = state.lock().await; debug!("{:?} Processing", path); //TODO: Actual processing - if path.as_os_str().len() > 100 { - //panic!("FUCK WHY ISN'T THIS SHIT RAN!??!??!?!??!??!"); - return Err(eyre!("Test termination")); - } Ok(()) } diff --git a/src/main.rs b/src/main.rs index 2cccd86..f8ffb84 100644 --- a/src/main.rs +++ b/src/main.rs @@ -76,9 +76,15 @@ async fn process_mock(state: Arc, file: String) async fn process(state: Arc, file: String) -> eyre::Result<()> { - delete::process(state, &file).await - .wrap_err(eyre!("Processing failed")) - .with_section(move || file.header("Root path was"))?; + let path = std::path::Path::new(&file); + if !path.exists() { + error!("{:?} does not exist, skipping", path); + } else { + info!("{:?} Processing", path); + delete::process(state, path).await + .wrap_err(eyre!("Processing failed")) + .with_section(move || file.header("Root path was"))?; + } Ok(()) } diff --git a/src/state.rs b/src/state.rs index 46fad65..62623f6 100644 --- a/src/state.rs +++ b/src/state.rs @@ -14,6 +14,7 @@ use futures::{ }; /// Contains state for a set of operations +//TODO: Add progress bar handler in here, when we get around to adding it. #[derive(Debug)] pub struct State {