Skip to content
Open
Show file tree
Hide file tree
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
9 changes: 2 additions & 7 deletions apps/app-frontend/src/components/ui/ExportModal.vue
Original file line number Diff line number Diff line change
Expand Up @@ -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 !== '') {
Expand Down
42 changes: 36 additions & 6 deletions packages/app-lib/src/api/profile/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -666,7 +666,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))?;
Expand Down Expand Up @@ -695,6 +695,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
Expand Down Expand Up @@ -726,14 +750,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)
Expand Down
Loading