From 8bcdfde0f01e81a28fe841a6be35df47a39e425f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20Havl=C3=AD=C4=8Dek?= Date: Wed, 1 Apr 2026 13:03:54 +0200 Subject: [PATCH] Fix cache manifest not saving: open MPQ writable in ProjectConfigBuilder MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit `ProjectConfigBuilder.apply()` opens the target map MPQ to save the updated cache manifest, but passes `readOnly=true` to `getEditor()`. The subsequent `saveManifest()` call tries to insert a file via `mpq.insertFile()`, which calls `JMpqEditor.deleteFile()` internally. JMPQ3 throws `NonWritableChannelException` (with a null message) when the editor is read-only, resulting in: Warning: Could not save manifest to MPQ: null This silently breaks the build caching system introduced in #1096 — every build becomes a full rebuild because the manifest is never persisted. Fix: change `readOnly` from `true` to `false` so the manifest can actually be written. --- .../de/peeeq/wurstio/languageserver/ProjectConfigBuilder.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/de.peeeq.wurstscript/src/main/java/de/peeeq/wurstio/languageserver/ProjectConfigBuilder.java b/de.peeeq.wurstscript/src/main/java/de/peeeq/wurstio/languageserver/ProjectConfigBuilder.java index f271c67cb..b6e3dbf85 100644 --- a/de.peeeq.wurstscript/src/main/java/de/peeeq/wurstio/languageserver/ProjectConfigBuilder.java +++ b/de.peeeq.wurstscript/src/main/java/de/peeeq/wurstio/languageserver/ProjectConfigBuilder.java @@ -97,8 +97,8 @@ public static MapRequest.CompilationResult apply(WurstProjectConfigData projectC // Apply map header (this is cheap, so we always do it) applyMapHeader(projectConfig, targetMap); - // Update the manifest with new config hash - try (MpqEditor mpq = MpqEditorFactory.getEditor(Optional.of(targetMap), true)) { + // Update the manifest with new config hash (must open writable to insert) + try (MpqEditor mpq = MpqEditorFactory.getEditor(Optional.of(targetMap), false)) { ImportFile.CacheManifest manifest = ImportFile.getCachedManifest(mpq).orElse(new ImportFile.CacheManifest()); manifest.setMapConfig(configHash); ImportFile.saveManifest(mpq, manifest);