From 84778837a9d1347432b9879ed83e387506c2acfd Mon Sep 17 00:00:00 2001 From: curly Date: Wed, 4 Jan 2023 12:29:50 -0700 Subject: handle file error --- src/lib.rs | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) (limited to 'src/lib.rs') diff --git a/src/lib.rs b/src/lib.rs index 3e4bad2..17b1c6f 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -213,8 +213,16 @@ impl S3G { // File scanning let mut file_string = String::new(); + + let string = match fs::read_to_string(&path) { + Ok(n) => n, + Err(_) => { + println!("Could not read file at: \"{}\", Continuing", &path.to_str().unwrap()); + String::from("") + } + }; - for line in fs::read_to_string(&path).unwrap().lines() { + for line in string.lines() { // NEED TO FOR LOOP ON COMMANDS AND FILES PREFIXES if line.contains(":?") { -- cgit v1.2.3