X-Git-Url: http://git.megacz.com/?a=blobdiff_plain;f=src%2Forg%2Fxwt%2FMain.java;h=5c25df5f6f053e9df1de3b5be202bb05af8f61cb;hb=16ad8b9430571d806f2aeb18ec472a277ff69423;hp=6bae13c133fa875b5be84eca2d445b26b8c0e4dd;hpb=75b9e1e72f6067e59a1e5312c91d20d05ec8a927;p=org.ibex.core.git diff --git a/src/org/xwt/Main.java b/src/org/xwt/Main.java index 6bae13c..5c25df5 100644 --- a/src/org/xwt/Main.java +++ b/src/org/xwt/Main.java @@ -24,6 +24,7 @@ public class Main { public static java.net.InetAddress originAddr = null; public static String originHost = null; public static String origin = null; + public static String initialTemplate = null; public static final Stream builtin = new Stream.Zip(new Stream.Builtin()); public static Picture scarImage = null; @@ -33,13 +34,15 @@ public class Main { System.err.println(""); System.err.println("Options:"); System.err.println(" -v verbose logging"); + System.err.println(" -s [not yet supported]"); + System.err.println(" -l [not yet supported]"); System.err.println(""); System.err.println("Source-location is one of the following:"); System.err.println(" - the path to an xwar file"); System.err.println(" - the path to a directory to be used as an xwar"); System.err.println(" - the http url of an xwar"); System.err.println(""); - System.err.println("Initial-template is the resource name of the template to load; defaults to 'main'"); + System.err.println("Initial-template is the path of the template to load; defaults to 'main'"); Runtime.getRuntime().exit(-1); } @@ -55,25 +58,22 @@ public class Main { Platform.forceLoad(); if (Log.on) for(int i=0; i startargs + 1 ? args[startargs + 1] : "main"; - initialTemplateName = initialTemplateName.replace('.', '/'); - initialTemplateName += ".xwt"; + initialTemplate = args.length > startargs + 1 ? args[startargs + 1] : "main"; origin = args[startargs]; Stream rr; - final String initialTemplate; - + final String startupTemplate; if (origin.startsWith("http://") || origin.startsWith("https://")) { originHost = origin.substring(origin.indexOf('/') + 2); originHost = originHost.substring(0, originHost.indexOf('/') == -1 ? originHost.length() : originHost.indexOf('/')); if (originHost.indexOf('@') != -1) originHost = originHost.substring(originHost.indexOf('@') + 1); originAddr = InetAddress.getByName(originHost); rr = builtin; - initialTemplate = "org/xwt/builtin/splash.xwt"; + startupTemplate = "org.xwt.builtin.splash"; } else { rr = new Stream.File(origin); if (!new File(origin).isDirectory()) rr = new Stream.Zip(rr); - initialTemplate = initialTemplateName; + startupTemplate = initialTemplate; } if (Log.on) Log.info(Main.class, "loading xwar"); @@ -83,7 +83,7 @@ public class Main { scarImage = Picture.load((Stream)Main.builtin.get("org/xwt/builtin/scar.png"), new Scheduler.Task() { public void perform() throws Exception { - new Template(Stream.getInputStream(final_rr.get(initialTemplate)), xwt).apply(new Box()); + new Template(Stream.getInputStream(xwt.resolveStringToResource(startupTemplate, false)), xwt).apply(new Box()); } }); Scheduler.init();