From 2b5ddee232192cfec268646ab05f952e4f8bcdfe Mon Sep 17 00:00:00 2001 From: Max Bradbury Date: Mon, 27 Jun 2022 23:00:08 +0100 Subject: [PATCH] don't panic if file already exists --- src/main.rs | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/main.rs b/src/main.rs index 17b1075..ef0671c 100644 --- a/src/main.rs +++ b/src/main.rs @@ -39,8 +39,10 @@ fn move_file(file: PathBuf, mut destination: PathBuf) { destination.push(file_name); - fs_extra::file::move_file(file, destination, &Default::default()) - .expect("Couldn't move file"); + match fs_extra::file::move_file(file, destination, &Default::default()) { + Ok(_) => println!("OK!"), + Err(e) => println!("Couldn't move file: {:?}", e), + } } fn yes() -> bool {