Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 18 additions & 0 deletions packages/app-lib/src/api/pack/install_mrpack.rs
Original file line number Diff line number Diff line change
@@ -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,
Expand Down Expand Up @@ -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 {
Expand Down Expand Up @@ -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))
Expand All @@ -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;
Expand Down
Loading