ccs.utils
Class DriveLister

java.lang.Object
  extended by ccs.utils.DriveLister

public class DriveLister
extends java.lang.Object

A problem with win32 is that multiple drives may or may not be present - any of A: to Z: and even a few more comedians as well (although these are not supported). UNIX variants use a unified filestore, so the only "drive" is root, "/".

This class was here to work around a bug in java.io.File.listRoots() which made it unusable on Win32. However, this bug has since been fixed (sort of) so it is no longer really necessary for that purpose. Hoewever, it has also acquired some utility methods, and there's no percentage in trying to kill it; this sort of buffer functionality is well within the traditions of ccs.utils.


Constructor Summary
DriveLister()
           
 
Method Summary
static boolean isWindows()
          Whether this machine is running Windows.
static java.lang.String[] listDriveIDs(java.io.File[] roots)
          Returns a list of unique IDs for the supplied drives; these are URL-friendly and don't contain any punctuation which might confuse the parser.
static java.io.File[] listDrives()
          Returns a list of the available root directories.
static java.lang.String[] listDrivesPrintably(java.io.File[] roots)
          Returns a list of drive names, in an output-friendly format.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DriveLister

public DriveLister()
Method Detail

listDrives

public static java.io.File[] listDrives()
Returns a list of the available root directories.

Returns:
The available (or potentially available) root directories. Win32: some types of removable media may be on the list even though the drive is not loaded. Attempts to do anything with the supplied File may go adrift, and apps should bear this in mind.

listDrivesPrintably

public static java.lang.String[] listDrivesPrintably(java.io.File[] roots)
Returns a list of drive names, in an output-friendly format.

Parameters:
roots - A list of available drives, obtained by a previous call to listDrives.
Returns:
The list.

listDriveIDs

public static java.lang.String[] listDriveIDs(java.io.File[] roots)
Returns a list of unique IDs for the supplied drives; these are URL-friendly and don't contain any punctuation which might confuse the parser.

Parameters:
roots - A list of available drives, obtained by a previous call to listDrives.
Returns:
The list.

isWindows

public static boolean isWindows()
Whether this machine is running Windows. The assumption is that, if it isn't, then it's running something unix-like; this includes OS X.

Returns:
Whether or not we're using a Real Operating System :-)