mirror of
https://github.com/architectury/architectury-loom.git
synced 2026-04-02 13:37:45 -05:00
use more reliable renamer, update Stitch - fix #46
This commit is contained in:
@@ -25,6 +25,7 @@
|
||||
package net.fabricmc.loom.task;
|
||||
|
||||
import com.google.common.io.ByteStreams;
|
||||
import com.google.common.io.Files;
|
||||
import net.fabricmc.loom.LoomGradleExtension;
|
||||
import net.fabricmc.loom.providers.MappingsProvider;
|
||||
import net.fabricmc.loom.providers.MinecraftLibraryProvider;
|
||||
@@ -92,7 +93,7 @@ public class GenSourcesTask extends DefaultLoomTask {
|
||||
project.getLogger().lifecycle(":readjusting line numbers");
|
||||
|
||||
File tmpJar = new File(mappedJar.getAbsolutePath() + ".tmp");
|
||||
mappedJar.renameTo(tmpJar);
|
||||
Files.move(mappedJar, tmpJar);
|
||||
try (
|
||||
FileInputStream fis = new FileInputStream(tmpJar);
|
||||
JarInputStream jis = new JarInputStream(fis);
|
||||
|
||||
@@ -24,6 +24,7 @@
|
||||
|
||||
package net.fabricmc.loom.util;
|
||||
|
||||
import com.google.common.io.Files;
|
||||
import net.fabricmc.loom.LoomGradleExtension;
|
||||
import net.fabricmc.loom.providers.MappingsProvider;
|
||||
import net.fabricmc.loom.task.RemapJar;
|
||||
@@ -34,6 +35,7 @@ import org.gradle.api.Project;
|
||||
import org.gradle.api.artifacts.Dependency;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.nio.file.Path;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
@@ -106,12 +108,16 @@ public class ModRemapper {
|
||||
}
|
||||
}
|
||||
|
||||
if (modJar.exists()) {
|
||||
modJar.renameTo(modJarUnmappedCopy);
|
||||
extension.addUnmappedMod(modJarUnmappedCopy);
|
||||
}
|
||||
try {
|
||||
if (modJar.exists()) {
|
||||
Files.move(modJar, modJarUnmappedCopy);
|
||||
extension.addUnmappedMod(modJarUnmappedCopy);
|
||||
}
|
||||
|
||||
modJarOutput.renameTo(modJar);
|
||||
Files.move(modJarOutput, modJar);
|
||||
} catch (IOException e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -91,8 +91,10 @@ public class SourceRemapper {
|
||||
}
|
||||
|
||||
source = new File(destination.getAbsolutePath().substring(0, destination.getAbsolutePath().lastIndexOf('.')) + "-dev.jar");
|
||||
if (!destination.renameTo(source)) {
|
||||
throw new RuntimeException("Could not rename " + destination.getName() + "!");
|
||||
try {
|
||||
com.google.common.io.Files.move(destination, source);
|
||||
} catch (IOException e) {
|
||||
throw new RuntimeException("Could not rename " + destination.getName() + "!", e);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user