[BUG] Fix DirectoryRelocatorTask processing files in the wrong locations
This commit is contained in:
@@ -5,7 +5,7 @@ plugins {
|
|||||||
}
|
}
|
||||||
|
|
||||||
group 'com.hypherionmc'
|
group 'com.hypherionmc'
|
||||||
version '1.0.0'
|
version '1.0.1'
|
||||||
|
|
||||||
repositories {
|
repositories {
|
||||||
mavenCentral()
|
mavenCentral()
|
||||||
|
@@ -43,7 +43,10 @@ final class DirectoryRelocatorTask {
|
|||||||
|
|
||||||
void processEntries() throws IOException {
|
void processEntries() throws IOException {
|
||||||
for (File entry : listAllFiles(inputDirectory)) {
|
for (File entry : listAllFiles(inputDirectory)) {
|
||||||
String name = entry.getName();
|
String name = entry.getAbsolutePath().replace(inputDirectory.getAbsolutePath(), "");
|
||||||
|
if (name.startsWith("/") || name.startsWith("\\"))
|
||||||
|
name = name.substring(1);
|
||||||
|
|
||||||
if (name.equals("META-INF/INDEX.LIST") || entry.isDirectory()) {
|
if (name.equals("META-INF/INDEX.LIST") || entry.isDirectory()) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
@@ -79,7 +82,10 @@ final class DirectoryRelocatorTask {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void processEntry(File entry, InputStream inputStream) throws IOException {
|
private void processEntry(File entry, InputStream inputStream) throws IOException {
|
||||||
String name = entry.getAbsolutePath();
|
String name = entry.getAbsolutePath().replace(inputDirectory.getAbsolutePath(), "");
|
||||||
|
if (name.startsWith("/") || name.startsWith("\\"))
|
||||||
|
name = name.substring(1);
|
||||||
|
|
||||||
String mappedName = this.remapper.map(name);
|
String mappedName = this.remapper.map(name);
|
||||||
|
|
||||||
// ensure the parent directory structure exists for the entry.
|
// ensure the parent directory structure exists for the entry.
|
||||||
@@ -115,8 +121,8 @@ final class DirectoryRelocatorTask {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void processResource(String name, InputStream entryIn) throws IOException {
|
private void processResource(String name, InputStream entryIn) throws IOException {
|
||||||
File file = new File(name);
|
File file = new File(inputDirectory, name);
|
||||||
File tmpFile = new File(name + ".tmp");
|
File tmpFile = new File(inputDirectory, name + ".tmp");
|
||||||
FileOutputStream outputStream = new FileOutputStream(tmpFile);
|
FileOutputStream outputStream = new FileOutputStream(tmpFile);
|
||||||
|
|
||||||
copy(entryIn, outputStream);
|
copy(entryIn, outputStream);
|
||||||
@@ -141,8 +147,8 @@ final class DirectoryRelocatorTask {
|
|||||||
|
|
||||||
// Need to take the .class off for remapping evaluation
|
// Need to take the .class off for remapping evaluation
|
||||||
String mappedName = this.remapper.map(name.substring(0, name.indexOf('.')));
|
String mappedName = this.remapper.map(name.substring(0, name.indexOf('.')));
|
||||||
File outName = new File(mappedName + ".class");
|
File outName = new File(inputDirectory, mappedName + ".class");
|
||||||
File tmpFile = new File(mappedName + ".tmp");
|
File tmpFile = new File(inputDirectory, mappedName + ".tmp");
|
||||||
FileOutputStream outputStream = new FileOutputStream(tmpFile);
|
FileOutputStream outputStream = new FileOutputStream(tmpFile);
|
||||||
|
|
||||||
// Now we put it back on so the class file is written out with the right extension.
|
// Now we put it back on so the class file is written out with the right extension.
|
||||||
@@ -168,8 +174,8 @@ final class DirectoryRelocatorTask {
|
|||||||
out.getEntries().put(entry.getKey(), outAttributes);
|
out.getEntries().put(entry.getKey(), outAttributes);
|
||||||
}
|
}
|
||||||
|
|
||||||
File outFile = new File(name);
|
File outFile = new File(inputDirectory, name);
|
||||||
File tempFile = new File(name + ".tmp");
|
File tempFile = new File(inputDirectory, name + ".tmp");
|
||||||
FileOutputStream outputStream = new FileOutputStream(tempFile);
|
FileOutputStream outputStream = new FileOutputStream(tempFile);
|
||||||
out.write(outputStream);
|
out.write(outputStream);
|
||||||
outputStream.close();
|
outputStream.close();
|
||||||
|
Reference in New Issue
Block a user