From 8e24492416c2304532a6ffa6284f4308a5999f9b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rafa=C5=82=20Mikrut?= <41945903+qarmin@users.noreply.github.com> Date: Thu, 22 Dec 2022 19:59:50 +0100 Subject: [PATCH] Always remove files created to check if hardlinking works (#883) --- czkawka_core/src/similar_videos.rs | 2 +- czkawka_gui/src/gui_structs/gui_bottom_buttons.rs | 6 ++++-- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/czkawka_core/src/similar_videos.rs b/czkawka_core/src/similar_videos.rs index 0eefcb6..fffe669 100644 --- a/czkawka_core/src/similar_videos.rs +++ b/czkawka_core/src/similar_videos.rs @@ -814,7 +814,7 @@ fn get_cache_file() -> String { } pub fn check_if_ffmpeg_is_installed() -> bool { - let vid = "999999999999999999.txt"; + let vid = "9999czekoczekoczekolada999.txt"; if let Err(DetermineVideo { src_path: _a, error: FfmpegNotFound, diff --git a/czkawka_gui/src/gui_structs/gui_bottom_buttons.rs b/czkawka_gui/src/gui_structs/gui_bottom_buttons.rs index 4d6120a..d5c1420 100644 --- a/czkawka_gui/src/gui_structs/gui_bottom_buttons.rs +++ b/czkawka_gui/src/gui_structs/gui_bottom_buttons.rs @@ -135,6 +135,8 @@ fn test_hardlinks() -> bool { use std::io::Write; use std::path::Path; + let mut hardlinked = false; + if let Some(proj_dirs) = ProjectDirs::from("pl", "Qarmin", "Czkawka") { let cache_dir = proj_dirs.cache_dir(); let cache_file = cache_dir.join(Path::new("GILLES_FROM_NOSE.temp")); @@ -153,12 +155,12 @@ fn test_hardlinks() -> bool { let _ = fs::hard_link(&cache_file, &cache_file_second); if cache_file.exists() && cache_file_second.exists() { - return true; + hardlinked = true; } } let _ = fs::remove_file(&cache_file); let _ = fs::remove_file(&cache_file_second); } - false + hardlinked }