List Windows FileStores misses named mounts
Bernd Eckenfels
ecki at zusammenkunft.net
Sat Jul 28 20:42:47 UTC 2018
Hello,
I noticed that fs.getRootDirectories() or fs.getFileStores() on Windows only list the Windows drives, but not other disks mounted on a path.
When I do the following I actually do get a FileStore for a Name-mounted FS:
FileSystem fs = FileSystems.getDefault();
Iterable<FileStore> rootStores = fs.getFileStores();
printStores(rootStores);
Path disk = Paths.get("C:", "temp", "disk").toAbsolutePath(); // mountpoint
FileSystemProvider fsp = FileSystemProvider.installedProviders().get(0);
FileStore fss = fsp.getFileStore(disk);
printStore(fss)
this is the result on my Windows (USB+Virtual Drive Name mounted)
root dir C:\
root dir D:\
(C:) (NTFS) 17.658,68 MB 243.303,05 MB rw r?=false cd?=false vsn=N/A on C:\
MYLINUXLIVE (D:) (FAT32) 226,73 MB 957,50 MB rw r?=true cd?=false vsn=N/A on D:\
--
vdisk (C:\temp\disk) (NTFS) 3,27 MB 7,00 MB rw r?=false cd?=false vsn=N/A on C:\temp\disk
Code: https://gist.github.com/ecki/da76c0e724e947ebb77a05094dac1f5c
Is there a reason why named Mounts are not listed and is there a cleaner way (without going through the FSP SPI) to get to its FileStore
Also what I noticed is that the „root“ member in WindowsFileSystem is the identifying part but there is no API (other than parsing .toString()) to get to it?
Gruss
Bernd
--
http://bernd.eckenfels.net
More information about the core-libs-dev
mailing list