diff --git a/packages/app-lib/src/state/profiles.rs b/packages/app-lib/src/state/profiles.rs index da89127559..22f6d2d548 100644 --- a/packages/app-lib/src/state/profiles.rs +++ b/packages/app-lib/src/state/profiles.rs @@ -417,6 +417,25 @@ struct InitialScanFile { cache_key: String, } +fn is_scannable_project_file( + project_type: ProjectType, + file_name: &str, +) -> bool { + let Some(extension) = Path::new(file_name.trim_end_matches(".disabled")) + .extension() + .and_then(|ext| ext.to_str()) + else { + return false; + }; + + match project_type { + ProjectType::Mod => extension.eq_ignore_ascii_case("jar"), + ProjectType::DataPack + | ProjectType::ResourcePack + | ProjectType::ShaderPack => extension.eq_ignore_ascii_case("zip"), + } +} + impl Profile { pub async fn get( path: &str, @@ -648,8 +667,10 @@ impl Profile { && let Some(file_name) = subdirectory .file_name() .and_then(|x| x.to_str()) - && !(project_type == ProjectType::ShaderPack - && file_name.ends_with(".txt")) + && is_scannable_project_file( + project_type, + file_name, + ) { let file_size = subdirectory .metadata() @@ -1052,8 +1073,10 @@ impl Profile { if subdirectory.is_file() && let Some(file_name) = subdirectory.file_name().and_then(|x| x.to_str()) - && !(project_type == ProjectType::ShaderPack - && file_name.ends_with(".txt")) + && is_scannable_project_file( + project_type, + file_name, + ) { let file_size = subdirectory .metadata()