Refactor SrgNamedWriter

This commit is contained in:
shedaniel
2021-01-10 17:12:42 +08:00
parent 39a3a301cf
commit e0f22f23da
2 changed files with 3 additions and 3 deletions

View File

@@ -183,7 +183,7 @@ public class MappingsProvider extends DependencyProvider {
}
if (!srgToNamedSrg.exists() || isRefreshDeps()) {
SrgNamedWriter.writeTo(getProject().getLogger(), srgToNamedSrg.toPath(), getMappingsWithSrg());
SrgNamedWriter.writeTo(getProject().getLogger(), srgToNamedSrg.toPath(), getMappingsWithSrg(), "srg", "named");
}
}

View File

@@ -10,10 +10,10 @@ import java.nio.file.Files;
import java.nio.file.Path;
public class SrgNamedWriter {
public static void writeTo(Logger logger, Path srgFile, TinyTree mappings) throws IOException {
public static void writeTo(Logger logger, Path srgFile, TinyTree mappings, String from, String to) throws IOException {
Files.deleteIfExists(srgFile);
try (SrgWriter writer = new SrgWriter(Files.newBufferedWriter(srgFile))) {
try (TinyMappingsReader reader = new TinyMappingsReader(mappings, "srg", "named")) {
try (TinyMappingsReader reader = new TinyMappingsReader(mappings, from, to)) {
writer.write(reader.read());
}
}