feat: export modpacks in CurseForge, Modrinth and MultiMC formats

Add shared export planning, cached scans, exact file selection, safe overwrite confirmation and background TUI progress. Refine sectioned confirmations and allow ordinary content changes while games run.

Invalidate stale export fingerprints on validation failure, preserve ownership and mutation checks, and use ordered lookups for unmatched-file highlighting. Add export, UI, locking and cache-recovery regression tests.
This commit is contained in:
objz committed 2026-10-25 19:12:29 +01:00
1 parent 1bc73258e2
commit 538c37f853
55 files changed
+4746 -448

No files matched your search

+41
View File
@@ -21,6 +21,23 @@ fn content_lock_excludes_independent_handles_until_drop() {
ContentLock::acquire(&path).unwrap();
}
#[test]
fn content_lock_with_held_instance_guard_still_excludes_other_manifest_handles() {
let temp = tempfile::tempdir().unwrap();
let guard = crate::instance::runtime::lock_instance(temp.path(), "Example").unwrap();
let path = temp.path().join("Example/rmcl/content/manifest.json");
let lock = ContentLock::acquire_with_held_instance_lock(&path, &guard).unwrap();
assert!(matches!(
ContentLock::acquire_with_held_instance_lock(&path, &guard),
Err(ManifestError::Busy(_))
));
drop(lock);
ContentLock::acquire_with_held_instance_lock(&path, &guard).unwrap();
assert!(ContentLock::acquire(&path).is_err());
drop(guard);
ContentLock::acquire(&path).unwrap();
}
#[test]
fn dropping_guard_releases_the_content_lock_with_a_duplicated_handle() {
let temp = tempfile::tempdir().unwrap();
@@ -191,6 +208,30 @@ fn fingerprint_contains_both_modrinth_hashes() {
assert_eq!(fingerprint.hash("sha512").unwrap().len(), 128);
}
#[test]
fn fingerprint_checks_cancellation_during_both_hashing_passes() {
let temp = tempfile::tempdir().unwrap();
let path = temp.path().join("example.jar");
std::fs::write(&path, [b'x'; 64 * 1024 + 1]).unwrap();
for cancel_at in [3, 6] {
let calls = std::cell::Cell::new(0);
let error = fingerprint_with_check(&path, || {
calls.set(calls.get() + 1);
if calls.get() == cancel_at {
Err(std::io::Error::new(
std::io::ErrorKind::Interrupted,
"cancelled",
))
} else {
Ok(())
}
})
.unwrap_err();
assert_eq!(error.kind(), std::io::ErrorKind::Interrupted);
assert_eq!(calls.get(), cancel_at);
}
}
#[test]
fn renaming_a_record_preserves_its_resolution() {
let mut manifest = ContentManifest::default();