Fix: update modpack export filter (#6359)

* Update Modpack export filters

* fix: move file export filtering from vue to rust

* chore: remove unused import

---------

Co-authored-by: Gravy Boat <gravy@thatgravyboat.tech>
This commit is contained in:
coolbot
2026-06-16 11:51:45 -07:00
committed by GitHub
parent 3aaa2ef071
commit 01fd18d550
2 changed files with 38 additions and 13 deletions
@@ -89,14 +89,9 @@ const initFiles = async () => {
disabled:
folder === 'profile.json' ||
folder.startsWith('modrinth_logs') ||
folder.startsWith('.fabric'),
folder.startsWith('.fabric') ||
folder.startsWith('__MACOSX'),
}))
.filter(
(pathData) =>
!pathData.path.includes('.DS_Store') &&
pathData.path !== 'mods/.connector' &&
!pathData.path.startsWith('mods/.connector/'),
)
.forEach((pathData) => {
const parent = pathData.path.split(sep).slice(0, -1).join(sep)
if (parent !== '') {
+36 -6
View File
@@ -667,7 +667,7 @@ pub async fn export_mrpack(
}
// File is not in the config file, add it to the .mrpack zip
if path.is_file() {
if path.is_file() && is_path_exportable(&relative_path) {
let mut file = File::open(&path)
.await
.map_err(|e| IOError::with_path(e, &path))?;
@@ -696,6 +696,30 @@ pub async fn export_mrpack(
Ok(())
}
fn is_path_exportable(relative_path: &SafeRelativeUtf8UnixPathBuf) -> bool {
if relative_path.ends_with(".DS_Store") {
return false;
}
if relative_path.starts_with("mods/.connector/")
|| relative_path.starts_with(".sable/natives/")
|| relative_path.starts_with("local/crash_assistant/")
|| relative_path.starts_with("mods/mcef-libraries/")
|| relative_path.starts_with("mods/mcef-cache/")
|| relative_path.starts_with("config/super_resolution/libraries/")
|| relative_path.starts_with("config/Veinminer/update/")
|| relative_path.starts_with("config/epicfight/native/")
|| relative_path.starts_with("essential/")
|| relative_path.starts_with(".mixin.out/")
|| relative_path.starts_with(".fabric/")
|| relative_path.starts_with("__MACOSX/")
{
return false;
}
true
}
// Given a folder path, populate a Vec of all the subfolders and files, at most 2 layers deep
// profile
// -- folder1
@@ -727,14 +751,20 @@ pub async fn get_pack_export_candidates(
.await
.map_err(|e| IOError::with_path(e, &profile_base_dir))?
{
path_list.push(pack_get_relative_path(
&profile_base_dir,
&entry.path(),
)?);
let relative =
pack_get_relative_path(&profile_base_dir, &entry.path())?;
if !is_path_exportable(&relative) {
continue;
}
path_list.push(relative);
}
} else {
// One layer of files/folders if its a file
path_list.push(pack_get_relative_path(&profile_base_dir, &path)?);
let relative = pack_get_relative_path(&profile_base_dir, &path)?;
if !is_path_exportable(&relative) {
continue;
}
path_list.push(relative);
}
}
Ok(path_list)