VirtualFilePermission(final String path, final int actionFlags, final boolean canonicalize) { super(canonicalize ? VFSUtils.canonicalize(path) : path); this.actionFlags = actionFlags & VALID_FLAGS; }
/** * In case the file system is not case sensitive we compare the canonical path with * the absolute path of the file after normalized. * @param file * @return */ public static boolean exists(File file) { try { boolean fileExists = file.exists(); if(!forceCaseSensitive || !fileExists) { return fileExists; } String absPath = canonicalize(file.getAbsolutePath()); String canPath = canonicalize(file.getCanonicalPath()); return fileExists && absPath.equals(canPath); } catch(IOException io) { return false; } }