move LocalStorage from core to plat
authoradam <adam@megacz.com>
Mon, 17 Jan 2005 01:07:53 +0000 (01:07 +0000)
committeradam <adam@megacz.com>
Mon, 17 Jan 2005 01:07:53 +0000 (01:07 +0000)
darcs-hash:20050117010753-5007d-07c08b4f200c88c6e00973af209c68743c738ede.gz

src/org/ibex/core/LocalStorage.java [deleted file]
src/org/ibex/plat/Platform.java

diff --git a/src/org/ibex/core/LocalStorage.java b/src/org/ibex/core/LocalStorage.java
deleted file mode 100644 (file)
index 0ad4826..0000000
+++ /dev/null
@@ -1,58 +0,0 @@
-// Copyright 2000-2005 the Contributors, as shown in the revision logs.
-// Licensed under the GNU General Public License version 2 ("the License").
-// You may not use this file except in compliance with the License.
-
-package org.ibex.core;
-
-import java.io.*;
-import org.ibex.util.*;
-import org.ibex.crypto.*;
-
-/** Manages access to ~/.ibex */
-public class LocalStorage {
-
-    static String ibexDirName = System.getProperty("user.home") + java.io.File.separatorChar + ".ibex";
-
-    static java.io.File ibexDir = null;
-    static java.io.File cacheDir = null;
-
-    static {
-        try {
-            ibexDir = new java.io.File(ibexDirName);
-            if (!ibexDir.mkdirs()) ibexDir = null;
-            try {
-                cacheDir = new java.io.File(ibexDirName + java.io.File.separatorChar + "cache");
-                if (!cacheDir.mkdirs()) cacheDir = null;
-            } catch (Exception e) {
-                Log.warn(LocalStorage.class, "unable to create cache directory " +
-                         ibexDirName + java.io.File.separatorChar + "cache");
-            }
-        } catch (Exception e) {
-            Log.warn(LocalStorage.class, "unable to create ibex directory " + ibexDirName);
-        }
-    }
-
-    // FEATURE: we ought to be able to do stuff like sha1-checking and date checking on cached resources    
-    public static class Cache {
-
-        private static void delTree(java.io.File f) throws IOException {
-            if (f.isDirectory()) {
-                String[] s = f.list();
-                for(int i=0; i<s.length; i++)
-                    delTree(new java.io.File(f.getPath() + java.io.File.separatorChar + s[i]));
-            }
-            f.delete();
-        }
-
-        public static void flush() throws IOException {
-            delTree(cacheDir);
-            cacheDir.mkdirs();
-        }
-
-        public static java.io.File getCacheFileForKey(String key) {
-            // FEATURE: be smarter here
-            return new java.io.File(cacheDir.getPath() + File.separatorChar + new String(Encode.toBase64(key.getBytes())));
-        }
-
-    }
-}
index 389caa4..32fea9d 100644 (file)
@@ -11,7 +11,7 @@ import org.ibex.js.*;
 import org.ibex.util.*;
 import org.ibex.graphics.*;
 import org.ibex.core.*;
-import org.ibex.graphics.*;
+import org.ibex.crypto.*;
 import org.ibex.core.*;
 import org.ibex.net.*;
 
@@ -378,6 +378,56 @@ public abstract class Platform {
             }
         }
     }
+
+    /** Manages access to ~/.ibex */
+    public static class LocalStorage {
+
+        static String ibexDirName = System.getProperty("user.home") + java.io.File.separatorChar + ".ibex";
+
+        static java.io.File ibexDir = null;
+        static java.io.File cacheDir = null;
+
+        static {
+            try {
+                ibexDir = new java.io.File(ibexDirName);
+                if (!ibexDir.mkdirs()) ibexDir = null;
+                try {
+                    cacheDir = new java.io.File(ibexDirName + java.io.File.separatorChar + "cache");
+                    if (!cacheDir.mkdirs()) cacheDir = null;
+                } catch (Exception e) {
+                    Log.warn(LocalStorage.class, "unable to create cache directory " +
+                             ibexDirName + java.io.File.separatorChar + "cache");
+                }
+            } catch (Exception e) {
+                Log.warn(LocalStorage.class, "unable to create ibex directory " + ibexDirName);
+            }
+        }
+
+        // FEATURE: we ought to be able to do stuff like sha1-checking and date checking on cached resources    
+        public static class Cache {
+
+            private static void delTree(java.io.File f) throws IOException {
+                if (f.isDirectory()) {
+                    String[] s = f.list();
+                    for(int i=0; i<s.length; i++)
+                        delTree(new java.io.File(f.getPath() + java.io.File.separatorChar + s[i]));
+                }
+                f.delete();
+            }
+
+            public static void flush() throws IOException {
+                delTree(cacheDir);
+                cacheDir.mkdirs();
+            }
+
+            public static java.io.File getCacheFileForKey(String key) {
+                // FEATURE: be smarter here
+                return new java.io.File(cacheDir.getPath() + File.separatorChar + new String(Encode.toBase64(key.getBytes())));
+            }
+
+        }
+    }
+
 }