Updated bundles with proper spacing

This commit is contained in:
Anuken
2020-01-08 10:59:29 -05:00
parent 6e5d506a35
commit 5ad09d6d80
26 changed files with 1521 additions and 78 deletions

View File

@ -1,23 +1,21 @@
package mindustry.tools;
import arc.struct.*;
import arc.files.*;
import arc.func.*;
import arc.struct.*;
import arc.util.*;
import arc.util.io.*;
import java.io.*;
public class BundleLauncher{
public static void main(String[] args) throws Exception{
File file = new File("bundle.properties");
public static void main(String[] args){
OrderedMap<String, String> base = new OrderedMap<>();
PropertiesUtils.load(base, new InputStreamReader(new FileInputStream(file)));
PropertiesUtils.load(base, Fi.get("bundle.properties").reader());
Array<String> removals = new Array<>();
String str = Fi.get("bundle.properties").readString();
ObjectSet<String> newlines = Array.with(str.split("\n")).select(l -> l.contains(" = ") && str.indexOf(l) + l.length() < str.length() - 2 && str.charAt(str.indexOf(l) + l.length() + 1) == '\n').map(l -> l.split(" = ")[0]).asSet();
Fi.get(".").walk(child -> {
if(child.name().equals("bundle.properties") || child.isDirectory() || child.toString().contains("output"))
return;
if(child.name().equals("bundle.properties") || child.toString().contains("output")) return;
Log.info("Parsing bundle: {0}", child);
@ -46,7 +44,7 @@ public class BundleLauncher{
}
}
Func2<String, String, String> processor = (key, value) -> (key + " = " + value).replace("\\", "\\\\").replace("\n", "\\n") + "\n";
Func2<String, String, String> processor = (key, value) -> (key + " = " + value).replace("\\", "\\\\").replace("\n", "\\n") + "\n" + (newlines.contains(key) ? "\n" : "");
Fi output = child.sibling("output/" + child.name());
Log.info("&lc{0} keys added.", added);