public File getFile ( String fileLocation ) { if ( ! alwaysUseCache ) { File f = new File ( fileLocation ) ; if ( f . exists ( ) ) return f ; if ( canWrite ( f ) ) return f ; } if ( neverUseCache ) { throw new IllegalStateException ( "neverUseCache=true, but file does not exist and directory is not writeable =" + fileLocation ) ; } File f = new File ( makeCachePath ( fileLocation ) ) ; if ( cachePathPolicy == CachePathPolicy . NestedDirectory ) { File dir = f . getParentFile ( ) ; if ( ! dir . exists ( ) && ! dir . mkdirs ( ) ) cacheLog . warn ( "Cant create directories for file " + dir . getPath ( ) ) ; } return f ; }
Get the named File . If exists or isWritable return it . Otherwise get corresponding file in the cache directory .