fix: ignore extensions for mrpack warning modal

This commit is contained in:
Calum H. (IMB11)
2026-07-31 07:29:38 +01:00
parent 65a3ac4b34
commit 347f6dcb84
@@ -1,4 +1,5 @@
use crate::State;
use crate::api::instance::CONFIG_FILE_EXTENSIONS;
use crate::event::emit::loading_try_for_each_concurrent;
use crate::install::{
InstallErrorContext, InstallJobEventKind, InstallPhaseDetails,
@@ -42,6 +43,19 @@ type ExtractProgressFn<'a> = dyn FnMut(u64) -> Pin<Box<dyn Future<Output = crate
+ Send
+ 'a;
const MODPACK_CONTENT_DOWNLOAD_CONCURRENCY: usize = 4;
const MRPACK_WARNING_IGNORED_EXTENSIONS: &[&str] = &["rpo"];
fn is_ignored_mrpack_warning_file(path: &str) -> bool {
Path::new(path)
.extension()
.and_then(|extension| extension.to_str())
.is_some_and(|extension| {
CONFIG_FILE_EXTENSIONS
.iter()
.chain(MRPACK_WARNING_IGNORED_EXTENSIONS)
.any(|candidate| extension.eq_ignore_ascii_case(candidate))
})
}
#[derive(Clone)]
struct ModpackContentInstallContext {
@@ -258,6 +272,9 @@ pub(crate) async fn get_external_files_from_mrpack(
.into_iter()
.filter_map(|file| {
let path = file.path.as_str();
if is_ignored_mrpack_warning_file(path) {
return None;
}
let hash = file.hashes.get(&PackFileHash::Sha1)?.clone();
let file_name = path.rsplit('/').next()?.to_string();
Some((file_name, hash))
@@ -275,6 +292,7 @@ pub(crate) async fn get_external_files_from_mrpack(
.strip_prefix("overrides/")
.or_else(|| path.strip_prefix("client-overrides/"))?;
if path.ends_with('/')
|| is_ignored_mrpack_warning_file(relative_path)
|| ProjectType::get_from_parent_folder(relative_path).is_none()
{
return None;