/** * Checks if <code>f</code> represents a real directory or file as opposed to a special folder * such as <code>"Desktop"</code>. Used by UI classes to decide if a folder is selectable when * doing directory choosing. * * @param f a <code>File</code> object * @return <code>true</code> if <code>f</code> is a real file or directory. * @since 1.4 */ public boolean isFileSystem(File f) { if (f instanceof ShellFolder) { ShellFolder sf = (ShellFolder) f; // Shortcuts to directories are treated as not being file system objects, // so that they are never returned by JFileChooser. return sf.isFileSystem() && !(sf.isLink() && sf.isDirectory()); } else { return true; } }