FileStore... getRootPath() ?

Alan Bateman Alan.Bateman at oracle.com
Thu Jul 1 02:06:03 PDT 2010


John Hendrikx wrote:
> Well, the filtering would simply do the following (for Linux, Windows 
> does not need any filtering, although applying the same filter would 
> not adversely affect the result):
>
> 1) spaceAttribs.totalSpace() != 0;  (eliminates /proc, /sys, etc..)
> 2) fileStore.type() != "tmpfs"; (eliminates /dev, /dev/shm, etc..)
>
> And although this is a bit of a kludge, on my test systems that leaves 
> me with only the mountpoints, ie.:
>
> / (/dev/hda2)
> /data (/dev/md0)
> /raid1 (/dev/mapper/raid1)
> /raid2 (/dev/mapper/raid2)
> /temp (/dev/mapper/temp)
>
> Those are then easy to present in a multi-column list with total size 
> and free space information.
>
> Reasons for needing such a list:
>
> 1) Allowing the user to select an entire volume (for backup, or 
> (restore) destination) for example.
> 2) Giving the user a start point for navigating the directory tree (on 
> Windows the drive letters work, although My Computer would be better.  
> On Linux "/" works, but is clumsy... most native apps will have a list 
> of mount points somewhere).
> 3) Informational.  Free and Total space shown in a monitoring 
> application or perhaps to select a suitable location to install 
> something big (with sufficient free space) :)
>
> I realize what I'm trying to do is probably a bit beyond NIO2's scope 
> -- but providing the user with a fully functional view of the 
> filesystems on a (any?) system is now close to possible (hence why I'm 
> trying this).
Providing access to the file system hierarchy makes sense for this API 
but I can't really offer any advice on how this should be filtered for 
the end-user. The above will help but likely be  too fragile for the 
number of possible file systems that your code might encounter.  It 
might be that you really just want to give the user the choice of a 
couple of locations, saying the user's home directory,  devices,  and 
perhaps other machines on the network. There is an opportunity for 
someone to develop a "desktop" file system provider that understand 
desktop concepts. It could be layered over the default provider and 
would make it easy to develop applications like the Nautilus file manager.

-Alan.


More information about the nio-dev mailing list