Commits

Stephen McKamey committed e851fa1

- minor tweaks to improve code portability

Comments (0)

Files changed (4)

src/org/duelengine/duel/DataEncoder.java

 		}
 	}
 
-	public static Snippet snippet(String text) {
+	public static Snippet asSnippet(String text) {
 		return new Snippet(text);
 	}
 
 	public void writeVars(Appendable output, SparseMap items)
 		throws IOException {
 
-		// begin by flattening the heirarchy whereever a SparseMap is encountered
+		// begin by flattening the heirarchy whenever a SparseMap is encountered
 		Map<String, Object> vars = new LinkedHashMap<String, Object>();
 		this.accumulateVars(items, vars, new StringBuilder());
 

src/org/duelengine/duel/codedom/CodeMethodInvokeExpression.java

 	private Class<?> resultType;
 	private CodeExpression target;
 	private String methodName;
-	private List<CodeExpression> arguments = new ArrayList<CodeExpression>();
+	private final List<CodeExpression> arguments = new ArrayList<CodeExpression>();
 
 	public CodeMethodInvokeExpression() {
 		this.setResultType(null);

src/org/duelengine/duel/codegen/CodeDOMBuilder.java

 				} catch (Exception ex) {
 					
 					// only defer attributes that cannot be processed server-side
-					deferredAttrs.put(attrName, DataEncoder.snippet(((CodeBlockNode)attrVal).getClientCode()));
+					deferredAttrs.put(attrName, DataEncoder.asSnippet(((CodeBlockNode)attrVal).getClientCode()));
 					argSize = Math.max(argSize, ((CodeBlockNode)attrVal).getArgSize());
 				}
 

src/org/duelengine/duel/compiler/DuelCompiler.java

 		}
 
 		DuelCompiler compiler = new DuelCompiler();
-		compiler.setInputRoot(new File(args[0].replace('\\', '/')));
+		compiler.setInputRoot(args[0]);
 
 		if (args.length > 1) {
-			compiler.setOutputClientFolder(new File(args[1].replace('\\', '/')));
+			compiler.setOutputClientFolder(args[1]);
 
 			if (args.length > 2) {
-				compiler.setOutputServerFolder(new File(args[2].replace('\\', '/')));
+				compiler.setOutputServerFolder(args[2]);
 			}
 		}
 
 	private String clientPrefix;
 	private String serverPrefix;
 
-	public File getInputRoot() {
-		return this.inputRoot;
+	public String getInputRoot() {
+		return this.inputRoot.getAbsolutePath();
 	}
 
-	public void setInputRoot(File value) {
-		this.inputRoot = value;
+	public void setInputRoot(String value) {
+		this.inputRoot = (value != null) ? new File(value.replace('\\', '/')) : null;
 	}
 
-	public File getOutputClientFolder() {
-		return this.outputClientFolder;
+	public String getOutputClientFolder() {
+		return this.outputServerFolder.getAbsolutePath();
 	}
 
-	public void setOutputClientFolder(File value) {
-		this.outputClientFolder = value;
+	public void setOutputClientFolder(String value) {
+		this.outputClientFolder = (value != null) ? new File(value.replace('\\', '/')) : null;
 	}
 
-	public File getOutputServerFolder() {
-		return this.outputServerFolder;
+	public String getOutputServerFolder() {
+		return this.outputServerFolder.getAbsolutePath();
 	}
 
-	public void setOutputServerFolder(File value) {
-		this.outputServerFolder = value;
+	public void setOutputServerFolder(String value) {
+		this.outputServerFolder = (value != null) ? new File(value.replace('\\', '/')) : null;
 	}
 
 	public String getClientPrefix() {