Skip to content

Commit

Permalink
Only respect use_mappingio=false when Enigma has an alternative rea…
Browse files Browse the repository at this point in the history
…der/writer
  • Loading branch information
NebelNidas committed Aug 25, 2024
1 parent 4f39292 commit 94fd83d
Showing 1 changed file with 2 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -69,11 +69,7 @@ public void write(EntryTree<EntryMapping> mappings, Path path, ProgressListener
}

public void write(EntryTree<EntryMapping> mappings, MappingDelta<EntryMapping> delta, Path path, ProgressListener progressListener, MappingSaveParameters saveParameters) {
if (!hasMappingIoWriter || !useMappingIo()) {
if (writer == null) {
throw new IllegalStateException(name() + " does not support writing");
}

if (!hasMappingIoWriter || (!useMappingIo() && writer != null)) {
writer.write(mappings, usedMappingIoWriterLast ? MappingDelta.added(mappings) : delta, path, progressListener, saveParameters);
usedMappingIoWriterLast = false;
return;
Expand Down Expand Up @@ -107,11 +103,7 @@ public EntryTree<EntryMapping> read(Path path, ProgressListener progressListener
}

public EntryTree<EntryMapping> read(Path path, ProgressListener progressListener, MappingSaveParameters saveParameters, JarIndex index) throws IOException, MappingParseException {
if (!useMappingIo()) {
if (reader == null) {
throw new IllegalStateException(name() + " does not support reading");
}

if (mappingIoCounterpart == null || (!useMappingIo() && reader != null)) {
return reader.read(path, progressListener, saveParameters);
}

Expand Down Expand Up @@ -180,9 +172,7 @@ public boolean isWritable() {
return writer != null || hasMappingIoWriter;
}

@ApiStatus.Internal
private boolean useMappingIo() {
if (mappingIoCounterpart == null) return false;
return System.getProperty("enigma.use_mappingio", "true").equals("true");
}

Expand Down

0 comments on commit 94fd83d

Please sign in to comment.