Always remove files created to check if hardlinking works (#883)

pull/895/head
Rafał Mikrut 1 year ago committed by GitHub
parent c9e9a65cc9
commit 8e24492416
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -814,7 +814,7 @@ fn get_cache_file() -> String {
} }
pub fn check_if_ffmpeg_is_installed() -> bool { pub fn check_if_ffmpeg_is_installed() -> bool {
let vid = "999999999999999999.txt"; let vid = "9999czekoczekoczekolada999.txt";
if let Err(DetermineVideo { if let Err(DetermineVideo {
src_path: _a, src_path: _a,
error: FfmpegNotFound, error: FfmpegNotFound,

@ -135,6 +135,8 @@ fn test_hardlinks() -> bool {
use std::io::Write; use std::io::Write;
use std::path::Path; use std::path::Path;
let mut hardlinked = false;
if let Some(proj_dirs) = ProjectDirs::from("pl", "Qarmin", "Czkawka") { if let Some(proj_dirs) = ProjectDirs::from("pl", "Qarmin", "Czkawka") {
let cache_dir = proj_dirs.cache_dir(); let cache_dir = proj_dirs.cache_dir();
let cache_file = cache_dir.join(Path::new("GILLES_FROM_NOSE.temp")); 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); let _ = fs::hard_link(&cache_file, &cache_file_second);
if cache_file.exists() && cache_file_second.exists() { if cache_file.exists() && cache_file_second.exists() {
return true; hardlinked = true;
} }
} }
let _ = fs::remove_file(&cache_file); let _ = fs::remove_file(&cache_file);
let _ = fs::remove_file(&cache_file_second); let _ = fs::remove_file(&cache_file_second);
} }
false hardlinked
} }

Loading…
Cancel
Save