< prev index next >

## src/java.desktop/windows/classes/sun/awt/shell/Win32ShellFolderManager2.java

Print this page

    *** 445,469 ****
              if (dir != null) {

                  if (dir instanceof Win32ShellFolder2) {
                      Win32ShellFolder2 sf = (Win32ShellFolder2)dir;

                      return (sf.isFileSystem() && sf.parent != null &&
    !                         sf.parent.equals(getDrives()));
                  }
    -             String path = dir.getPath();

                  if (path.length() != 3 || path.charAt(1) != ':') {
                      return false;
                  }
    -
                  File[] roots = Win32ShellFolder2.listRoots();
    -
                  return roots != null && Arrays.asList(roots).contains(dir);
              }
    -         return false;
    -     }

          private static List<Win32ShellFolder2> topFolderList = null;
          static int compareShellFolders(Win32ShellFolder2 sf1, Win32ShellFolder2 sf2) {
              boolean special1 = sf1.isSpecial();
              boolean special2 = sf2.isSpecial();
    --- 445,474 ----
              if (dir != null) {

                  if (dir instanceof Win32ShellFolder2) {
                      Win32ShellFolder2 sf = (Win32ShellFolder2)dir;

    +                 //This includes all the drives under "My PC" or "My Computer.
    +                 // On windows 10, "External Drives" are listed under "Desktop"
    +                 // also
                      return  (sf.isFileSystem() && sf.parent != null &&
    !                         (sf.parent.equals (getDrives()) ||
    !                         (sf.parent.equals (getDesktop()) && isDrive(dir))));
    !             }
    !             return isDrive(dir);
    !         }
    !         return false;
          }

    +     private boolean isDrive(File dir) {
    +         String path = dir.getPath();
              if (path.length() != 3 || path.charAt(1) != ':') {
                  return false;
              }
              File[] roots = Win32ShellFolder2.listRoots();
              return roots != null && Arrays.asList(roots).contains(dir);
          }

          private static List<Win32ShellFolder2> topFolderList = null;
          static int compareShellFolders(Win32ShellFolder2 sf1, Win32ShellFolder2 sf2) {
              boolean special1 = sf1.isSpecial();
              boolean special2 = sf2.isSpecial();

< prev index next >