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;
        }
    }
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 ; } }
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