/** * Get a file in the cache. * File may or may not exist. We assume its always writeable. * If it does exist, set its LastModifiedDate to current time. * * @param fileLocation normal file location * @return equivilent File in the cache. */ static public File getCacheFile(String fileLocation) { File f = new File(makeCachePath(fileLocation)); if (f.exists()) f.setLastModified(System.currentTimeMillis()); if (!checkExist) { File dir = f.getParentFile(); dir.mkdirs(); checkExist = true; } return f; }
/** * Get a file in the cache. * File may or may not exist. We assume its always writeable. * If it does exist, set its LastModifiedDate to current time. * * @param fileLocation normal file location * @return equivalent File in the cache. */ static public File getCacheFile(String fileLocation) { File f = new File(makeCachePath(fileLocation)); if (f.exists()) f.setLastModified(System.currentTimeMillis()); if (!checkExist) { File dir = f.getParentFile(); dir.mkdirs(); checkExist = true; } return f; }
/** * Get a file in the cache. * File may or may not exist. We assume its always writeable. * If it does exist, set its LastModifiedDate to current time. * * @param fileLocation normal file location * @return equivalent File in the cache. */ static public File getCacheFile(String fileLocation) { File f = new File(makeCachePath(fileLocation)); if (f.exists()) { if (!f.setLastModified(System.currentTimeMillis())) logger.warn("Failed to setLastModified on " + f.getPath()); } if (!checkExist) { File dir = f.getParentFile(); if (!dir.exists() && !dir.mkdirs()) logger.warn("Failed to mkdirs on " + dir.getPath()); checkExist = true; } return f; }