From 1f616001dc90cf014bf42ddf23e4154c10cd9dec Mon Sep 17 00:00:00 2001 From: Ben Fry Date: Sat, 21 Sep 2013 10:18:46 -0400 Subject: [PATCH] more cleanup --- .../com/oracle/appbundler/AppBundlerTask.java | 36 ++++++++++++------- 1 file changed, 23 insertions(+), 13 deletions(-) diff --git a/build/macosx/appbundler/src/com/oracle/appbundler/AppBundlerTask.java b/build/macosx/appbundler/src/com/oracle/appbundler/AppBundlerTask.java index a5f01ba64..c9d256e8d 100644 --- a/build/macosx/appbundler/src/com/oracle/appbundler/AppBundlerTask.java +++ b/build/macosx/appbundler/src/com/oracle/appbundler/AppBundlerTask.java @@ -516,7 +516,8 @@ public class AppBundlerTask extends Task { class PropertyLister { PrintWriter writer; - int indentSpaces = 2; +// int indentSpaces = 2; + String indentSpaces = " "; // int indentLevel; Stack elements = new Stack<>(); @@ -553,23 +554,19 @@ public class AppBundlerTask extends Task { } void writeStartElement(String element) { + emitIndent(); writer.println("<" + element + ">"); // indentLevel++; elements.push(element); } void writeEndElement() { - emitIndent(); + emitOutdent(); writer.println(""); } - void writeSingle(String tag, String content) { - emitIndent(); - writer.println("<" + tag + ">" + content + ""); - } - void writeKey(String key) { - writeSingle(KEY_TAG, key); + emitSingle(KEY_TAG, key); // emitIndent(); // writer.println("" + key + ""); } @@ -577,7 +574,7 @@ public class AppBundlerTask extends Task { void writeString(String value) { // emitIndent(); // writer.println("" + value + ""); - writeSingle(STRING_TAG, value); + emitSingle(STRING_TAG, value); } void writeBoolean(boolean value) { @@ -590,11 +587,23 @@ public class AppBundlerTask extends Task { writeString(value); } - void emitIndent() { + private void emitSingle(String tag, String content) { + emitIndent(); + writer.println("<" + tag + ">" + content + ""); + } + + private void emitIndent() { for (int i = 0; i < elements.size(); i++) { - for (int j = 0; j < indentSpaces; j++) { - writer.print(' '); - } +// for (int j = 0; j < indentSpaces; j++) { +// writer.print(' '); +// } + writer.print(indentSpaces); + } + } + + private void emitOutdent() { + for (int i = 0; i < elements.size() - 1; i++) { + writer.print(indentSpaces); } } } @@ -603,6 +612,7 @@ public class AppBundlerTask extends Task { private void writeInfoPlist(File file) throws IOException { FileOutputStream output = new FileOutputStream(file); PropertyLister xout = new PropertyLister(output); + xout.writeStartDocument(); xout.println(PLIST_DTD);