X-Git-Url: http://git.megacz.com/?a=blobdiff_plain;f=src%2Forg%2Fxwt%2FLocalStorage.java;h=376ccb8886a642b79717e132cf1354bcddfbcda0;hb=16c24a73c1c1b2955db0bbbaf5a940215329bca1;hp=a33166fd7b5b63965a5652b184dcaf20f5fedb90;hpb=018db8945865e74c2d79a49d02ead5ee0d9feb54;p=org.ibex.core.git diff --git a/src/org/xwt/LocalStorage.java b/src/org/xwt/LocalStorage.java index a33166f..376ccb8 100644 --- a/src/org/xwt/LocalStorage.java +++ b/src/org/xwt/LocalStorage.java @@ -1,4 +1,4 @@ -// Copyright 2003 Adam Megacz, see the COPYING file for licensing [GPL] +// Copyright 2004 Adam Megacz, see the COPYING file for licensing [GPL] package org.xwt; import java.io.*; @@ -13,33 +13,33 @@ public class LocalStorage { static String xwtDirName = System.getProperty("user.home") + java.io.File.separatorChar + ".xwt"; - static File xwtDir = null; - static File cacheDir = null; + static java.io.File xwtDir = null; + static java.io.File cacheDir = null; static { try { - xwtDir = new File(xwtDirName); + xwtDir = new java.io.File(xwtDirName); if (!xwtDir.mkdirs()) xwtDir = null; + try { + cacheDir = new java.io.File(xwtDirName + java.io.File.separatorChar + "cache"); + if (!cacheDir.mkdirs()) cacheDir = null; + } catch (Exception e) { + Log.warn(LocalStorage.class, "unable to create cache directory " + + xwtDirName + java.io.File.separatorChar + "cache"); + } } catch (Exception e) { - Log.log(LocalStorage.class, "unable to create xwt directory " + xwtDirName); - } - try { - cacheDir = new File(xwtDirName + java.io.File.separatorChar + "cache"); - if (!cacheDir.mkdirs()) cacheDir = null; - } catch (Exception e) { - Log.log(LocalStorage.class, "unable to create cache directory " + xwtDirName + java.io.File.separatorChar + "cache"); + Log.warn(LocalStorage.class, "unable to create xwt directory " + xwtDirName); } } - // 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(File f) throws IOException { + private static void delTree(java.io.File f) throws IOException { if (f.isDirectory()) { String[] s = f.list(); for(int i=0; i