diff options
Diffstat (limited to 'src-tauri/src/repair_and_verify')
-rw-r--r-- | src-tauri/src/repair_and_verify/mod.rs | 34 |
1 files changed, 19 insertions, 15 deletions
diff --git a/src-tauri/src/repair_and_verify/mod.rs b/src-tauri/src/repair_and_verify/mod.rs index 17c71992..29cc9613 100644 --- a/src-tauri/src/repair_and_verify/mod.rs +++ b/src-tauri/src/repair_and_verify/mod.rs @@ -40,26 +40,30 @@ pub fn clean_up_download_folder( game_install: &GameInstall, force: bool, ) -> Result<(), anyhow::Error> { - // Get download directory - let download_directory = format!( - "{}/___flightcore-temp-download-dir/", - game_install.game_path - ); + const TEMPORARY_DIRECTORIES: [&str; 3] = [ + "___flightcore-temp-download-dir", + "___flightcore-temp/download-dir", + "___flightcore-temp", + ]; - // Check if files in folder - let download_dir_contents = std::fs::read_dir(download_directory.clone())?; - // dbg!(download_dir_contents); + for directory in TEMPORARY_DIRECTORIES { + // Get download directory + let download_directory = format!("{}/{}/", game_install.game_path, directory); - let mut count = 0; - download_dir_contents.for_each(|_| count += 1); + // Check if files in folder + let download_dir_contents = std::fs::read_dir(download_directory.clone())?; + // dbg!(download_dir_contents); - if count > 0 && !force { - return Err(anyhow!("Folder not empty, not deleting")); - } + let mut count = 0; + download_dir_contents.for_each(|_| count += 1); - // Delete folder - std::fs::remove_dir_all(download_directory)?; + if count > 0 && !force { + return Err(anyhow!("Folder not empty, not deleting")); + } + // Delete folder + std::fs::remove_dir_all(download_directory)?; + } Ok(()) } |