static FileStore getFileStore(Path path) throws IOException { FileStore store = Files.getFileStore(path); String mount = getMountPoint(store); // find the "matching" FileStore from system list, it's the one we want, but only return // that if it's unambiguous (only one matching): FileStore sameMountPoint = null; for (FileStore fs : path.getFileSystem().getFileStores()) { if (mount.equals(getMountPoint(fs))) { if (sameMountPoint == null) { sameMountPoint = fs; } else { // more than one filesystem has the same mount point; something is wrong! // fall back to crappy one we got from Files.getFileStore return store; } } } if (sameMountPoint != null) { // ok, we found only one, use it: return sameMountPoint; } else { // fall back to crappy one we got from Files.getFileStore return store; } }
static FileStore getFileStore(Path path) throws IOException { FileStore store = Files.getFileStore(path); String mount = getMountPoint(store); // find the "matching" FileStore from system list, it's the one we want, but only return // that if it's unambiguous (only one matching): FileStore sameMountPoint = null; for (FileStore fs : path.getFileSystem().getFileStores()) { if (mount.equals(getMountPoint(fs))) { if (sameMountPoint == null) { sameMountPoint = fs; } else { // more than one filesystem has the same mount point; something is wrong! // fall back to crappy one we got from Files.getFileStore return store; } } } if (sameMountPoint != null) { // ok, we found only one, use it: return sameMountPoint; } else { // fall back to crappy one we got from Files.getFileStore return store; } }
static FileStore getFileStore(Path path) throws IOException { FileStore store = Files.getFileStore(path); String mount = getMountPoint(store); // find the "matching" FileStore from system list, it's the one we want, but only return // that if it's unambiguous (only one matching): FileStore sameMountPoint = null; for (FileStore fs : path.getFileSystem().getFileStores()) { if (mount.equals(getMountPoint(fs))) { if (sameMountPoint == null) { sameMountPoint = fs; } else { // more than one filesystem has the same mount point; something is wrong! // fall back to crappy one we got from Files.getFileStore return store; } } } if (sameMountPoint != null) { // ok, we found only one, use it: return sameMountPoint; } else { // fall back to crappy one we got from Files.getFileStore return store; } }
static FileStore getFileStore(Path path) throws IOException { FileStore store = Files.getFileStore(path); String mount = getMountPoint(store); // find the "matching" FileStore from system list, it's the one we want, but only return // that if it's unambiguous (only one matching): FileStore sameMountPoint = null; for (FileStore fs : path.getFileSystem().getFileStores()) { if (mount.equals(getMountPoint(fs))) { if (sameMountPoint == null) { sameMountPoint = fs; } else { // more than one filesystem has the same mount point; something is wrong! // fall back to crappy one we got from Files.getFileStore return store; } } } if (sameMountPoint != null) { // ok, we found only one, use it: return sameMountPoint; } else { // fall back to crappy one we got from Files.getFileStore return store; } }