From 5847b6a28a0e6956bd5d896ea39e9b25dd3f847a Mon Sep 17 00:00:00 2001 From: mxve <68632137+mxve@users.noreply.github.com> Date: Wed, 16 Aug 2023 13:00:15 +0200 Subject: [PATCH] don't copy if current & target path are the same --- src/main.rs | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/main.rs b/src/main.rs index 777ec74..34e0f0e 100644 --- a/src/main.rs +++ b/src/main.rs @@ -168,8 +168,12 @@ fn windows_launcher_install(games: &Vec) { let game = games.iter().find(|&g| g.app_id == input).unwrap(); let launcher_path = std::env::current_exe().unwrap(); - fs::copy(launcher_path, path.join("alterware-launcher.exe")).unwrap(); - println!("Launcher copied to {}", path.display()); + let target_path = path.join("alterware-launcher.exe"); + + if launcher_path != target_path { + fs::copy(launcher_path, target_path).unwrap(); + println!("Launcher copied to {}", path.display()); + } setup_client_links(game, path); println!("Create Desktop shortcut? (Y/n)");