diff options
author | Ben Bridle <bridle.benjamin@gmail.com> | 2025-01-22 13:22:15 +1300 |
---|---|---|
committer | Ben Bridle <bridle.benjamin@gmail.com> | 2025-01-22 13:22:15 +1300 |
commit | e3c4ff5e93f2cd95dfa73dd779202481ec5dd01b (patch) | |
tree | 103c5ca078b50fefb1901d140e38dbb1f9f74854 /src | |
parent | b511a1a64e9076a040baf3c02a1587c40d0ec172 (diff) | |
download | toaster-e3c4ff5e93f2cd95dfa73dd779202481ec5dd01b.zip |
Improve error message when source directory cannot be found
Diffstat (limited to 'src')
-rw-r--r-- | src/main.rs | 5 |
1 files changed, 4 insertions, 1 deletions
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(); |