From e3c4ff5e93f2cd95dfa73dd779202481ec5dd01b Mon Sep 17 00:00:00 2001
From: Ben Bridle <bridle.benjamin@gmail.com>
Date: Wed, 22 Jan 2025 13:22:15 +1300
Subject: Improve error message when source directory cannot be found

---
 src/main.rs | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

(limited to 'src/main.rs')

diff --git a/src/main.rs b/src/main.rs
index 0fccc2b..2920917 100644
--- a/src/main.rs
+++ b/src/main.rs
@@ -51,7 +51,10 @@ fn main() {
     if args.source.is_none() || args.destination.is_none() {
         error!("Provide a source directory and a destination directory.")
     }
-    let source_directory = args.source.unwrap().canonicalize().unwrap();
+    let source_directory = match args.source.as_ref().unwrap().canonicalize() {
+        Ok(source_directory) => source_directory,
+        Err(err) => error!("{:?}: {err}", args.source.unwrap()),
+    };
     let destination_directory = args.destination.unwrap();
 
 
-- 
cgit v1.2.3-70-g09d2