PropertyFile regex bugfix
authoradam <adam@megacz.com>
Sat, 8 May 2004 07:55:18 +0000 (07:55 +0000)
committeradam <adam@megacz.com>
Sat, 8 May 2004 07:55:18 +0000 (07:55 +0000)
darcs-hash:20040508075518-5007d-29493d761deda56de9112795f1bbc798e62683dc.gz

src/org/ibex/js/PropertyFile.java

index c60e43d..3227922 100644 (file)
@@ -27,7 +27,7 @@ public class PropertyFile extends JS {
         }
         public void put(Object key, Object val) throws JSExn {
             try {
         }
         public void put(Object key, Object val) throws JSExn {
             try {
-                p.put(prefix + "." + escape(toString(key)), toString(val));
+                p.put(prefix + (prefix.equals("") ? "" : ".") + escape(toString(key)), toString(val));
                 File fnew = new File(f.getName() + ".new");
                 FileOutputStream fo = new FileOutputStream(fnew);
                 p.save(fo, "");
                 File fnew = new File(f.getName() + ".new");
                 FileOutputStream fo = new FileOutputStream(fnew);
                 p.save(fo, "");
@@ -39,7 +39,7 @@ public class PropertyFile extends JS {
     }
 
     public static String escape(String s) {
     }
 
     public static String escape(String s) {
-        return s.replaceAll("\\\\", "\\\\\\\\").replaceAll(".", "\\\\.").replaceAll("=","\\\\="); }
+        return s.replaceAll("\\\\", "\\\\\\\\").replaceAll("\\.", "\\\\.").replaceAll("=","\\\\="); }
     public PropertyFile(File f) throws IOException { this.f = f; this.p.load(new FileInputStream(f)); }
     public void put(Object key, Object val) throws JSExn { new Minion("").put(key, val); }
     public Enumeration keys() throws JSExn { return new Minion("").keys(); }
     public PropertyFile(File f) throws IOException { this.f = f; this.p.load(new FileInputStream(f)); }
     public void put(Object key, Object val) throws JSExn { new Minion("").put(key, val); }
     public Enumeration keys() throws JSExn { return new Minion("").keys(); }