[BUG] Fix UTF-8 values in remapped text files
This commit is contained in:
@@ -1,2 +1,2 @@
|
|||||||
version_base=1.0
|
version_base=1.0
|
||||||
version_patch=4
|
version_patch=5
|
@@ -24,6 +24,7 @@ import java.io.File;
|
|||||||
import java.io.FileInputStream;
|
import java.io.FileInputStream;
|
||||||
import java.io.FileOutputStream;
|
import java.io.FileOutputStream;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
|
import java.nio.charset.StandardCharsets;
|
||||||
import java.nio.file.Files;
|
import java.nio.file.Files;
|
||||||
import java.nio.file.StandardCopyOption;
|
import java.nio.file.StandardCopyOption;
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
@@ -409,27 +410,16 @@ public class JarMergeAction {
|
|||||||
relocations.put(group.replace(".", "/"), identifier + "/" + group.replace(".", "/"));
|
relocations.put(group.replace(".", "/"), identifier + "/" + group.replace(".", "/"));
|
||||||
|
|
||||||
for (File file : getTextFiles(workingDir)) {
|
for (File file : getTextFiles(workingDir)) {
|
||||||
FileInputStream fis = new FileInputStream(file);
|
List<String> lines = FileUtils.readLines(file, StandardCharsets.UTF_8);
|
||||||
Scanner scanner = new Scanner(fis);
|
|
||||||
StringBuilder sb = new StringBuilder();
|
StringBuilder sb = new StringBuilder();
|
||||||
|
|
||||||
while (scanner.hasNext()) {
|
for (String line : lines) {
|
||||||
String line = scanner.nextLine();
|
for (HashMap.Entry<String, String> entry : relocations.entrySet()) {
|
||||||
for (Map.Entry<String, String> entry : relocations.entrySet()) {
|
|
||||||
line = line.replace(entry.getKey(), entry.getValue());
|
line = line.replace(entry.getKey(), entry.getValue());
|
||||||
}
|
}
|
||||||
sb.append(line);
|
sb.append(line).append("\n");
|
||||||
|
|
||||||
if (scanner.hasNext())
|
|
||||||
sb.append("\n");
|
|
||||||
}
|
}
|
||||||
|
FileUtils.write(file, sb.toString().trim(), StandardCharsets.UTF_8);
|
||||||
scanner.close();
|
|
||||||
fis.close();
|
|
||||||
FileOutputStream fos = new FileOutputStream(file);
|
|
||||||
fos.write(sb.toString().getBytes());
|
|
||||||
fos.flush();
|
|
||||||
fos.close();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user