2003/10/29 00:53:07
[org.ibex.core.git] / src / org / xwt / Res.java
index 54bebcb..6bf79a3 100644 (file)
@@ -142,6 +142,16 @@ public abstract class Res extends JS {
         }
     }
 
+    /** the Builtin resource */
+    public static class Builtin extends Res {
+       public Builtin() { };
+       public String getDescriptiveName() { return "[builtin]"; }
+       public InputStream getInputStream(String path) throws IOException {
+           if (!path.equals("")) throw new IOException("the builtin resource has no subresources");
+           return Platform.getBuiltinInputStream();
+       }
+    }
+
     /** what you get when you reference a subresource */
     public static class Ref extends Res {
         Res parent;
@@ -149,7 +159,9 @@ public abstract class Res extends JS {
         Ref(Res parent, Object key) { this.parent = parent; this.key = key; }
         public String getDescriptiveName() {
             String pdn = parent.getDescriptiveName();
-            return pdn.equals("") ? key.toString() : (pdn + "." + key.toString());
+           if (pdn.equals("")) return key.toString();
+           if (!pdn.endsWith("!")) pdn += ".";
+           return pdn + key.toString();
         }
         public Res addExtension(String extension) {
             return (key instanceof String && ((String)key).endsWith(extension)) ? this : new Ref(parent, key + extension);