2002/05/28 21:30:03
[org.ibex.core.git] / src / org / xwt / Main.java
index 61c4615..f96bdf1 100644 (file)
@@ -19,6 +19,9 @@ public class Main extends Applet {
     /** scripts are allowed to make XMLRPC/SOAP calls to their origin address, even if it is firewalled */
     public static java.net.InetAddress originAddr = null;
 
+    /** the URL where the initial xwar came from */
+    public static String origin = null;
+
     /** see Template.numUnits() for a description */
     public static int instantiatedUnits = 0;
 
@@ -89,6 +92,7 @@ public class Main extends Applet {
             if (args.length > startargs) {
                 if (args[startargs].startsWith("http://")) {
                     if (Log.on) Log.log(Main.class, "downloading xwar");
+                    origin = args[startargs];
                     URL u = new URL(args[startargs]);
                     try {
                         originAddr = InetAddress.getByName(u.getHost());
@@ -99,13 +103,13 @@ public class Main extends Applet {
                     Resources.loadArchive(new HTTP(args[startargs]).getInputStream());
                     
                 } else {
-
                     if (Log.on) Log.log(Main.class, "loading xwar from local filesystem");
                     // HACK because MSIE turns \'s into /'s in URLs... argh!!
                     if (Platform.platform.getClass().getName().endsWith("Win32"))
                         args[startargs] = args[startargs].replace('/', '\\');
 
                     File f = new File(args[startargs]);
+                    origin = "file://" + f.getAbsolutePath();
                     if (f.isDirectory()) Resources.loadDirectory(f);
                     else Resources.loadArchive(new FileInputStream(f));
                 }