X-Git-Url: http://git.megacz.com/?a=blobdiff_plain;f=src%2Forg%2Fibex%2FIbex.java;h=3828b1784cf85db9e09a924372d790e21651edcd;hb=e2dab289d7adfebb01adf5ce782e7fa1b122cded;hp=0e04205744255ec7ab46397959fd4970f305c009;hpb=c04af3bec88e6cbaf461700900d00d1e4d096d26;p=org.ibex.core.git diff --git a/src/org/ibex/Ibex.java b/src/org/ibex/Ibex.java index 0e04205..3828b17 100644 --- a/src/org/ibex/Ibex.java +++ b/src/org/ibex/Ibex.java @@ -169,6 +169,10 @@ public final class Ibex extends JS.Cloneable { else if (url.startsWith("https://")) return new Stream.HTTP(url); else if (url.startsWith("data:")) return new Stream.ByteArray(Base64.decode(url.substring(5)), null); else if (url.startsWith("utf8:")) return new Stream.ByteArray(url.substring(5).getBytes(), null); + else if (url.startsWith("file:")) { + // FIXME + Platform.fileDialog(url.substring(5), false); + } throw new JSExn("invalid resource specifier " + url); } case "thread.sleep": sleep(JS.toInt(a)); return null; @@ -335,7 +339,8 @@ public final class Ibex extends JS.Cloneable { public JSScope getStatic() { try { // FIXME background? - if (t == null) t = Template.buildTemplate(Stream.getInputStream(parent.get(parentkey + ".ixt")), ibex); + if (t == null) + t = Template.buildTemplate(parentkey + ".t", Stream.getInputStream(parent.get(parentkey + ".t")), ibex); return t.staticScope; } catch (Exception e) { Log.error(this, e); @@ -344,9 +349,10 @@ public final class Ibex extends JS.Cloneable { } public Object call(Object a, Object b, Object c, Object[] rest, int nargs) throws JSExn { // GROSS hack - if (nargs == 9999) return t; - if (nargs != 1) throw new JSExn("FIXME can only call with one arg"); + if (nargs != 1 && nargs != 9999) throw new JSExn("FIXME can only call with one arg"); getStatic(); + if (t == null) throw new JSExn("No such template " + parentkey); + if (nargs == 9999) return t; t.apply((Box)a); return a; }