File-system case sensitivity


J

Jeffrey Schwab

Is there a decent way to check whether an application's local
file-system is case sensitive?
 
Ad

Advertisements

M

Martin Lansler

The 'equals' method in File can be used:

File f = new File(System.getProperty("java.home"));
File fLower = new File(f.getCanonicalPath().toLowerCase());
File fUpper = new File(f.getCanonicalPath().toUpperCase());
System.out.println("isCaseSensitive: " + !(fUpper.equals(fLower)));

Running on windows this gives false, should give true on Unix machines.

Regards,
Martin.
 
Ad

Advertisements

S

Steve W. Jackson

"Martin Lansler said:
The 'equals' method in File can be used:

File f = new File(System.getProperty("java.home"));
File fLower = new File(f.getCanonicalPath().toLowerCase());
File fUpper = new File(f.getCanonicalPath().toUpperCase());
System.out.println("isCaseSensitive: " + !(fUpper.equals(fLower)));

Running on windows this gives false, should give true on Unix machines.

Regards,
Martin.

Doesn't work on Mac OS X. The HFS+ filesystem is case preserving but
not case-sensitive. The above reports reports that it is case sensitive.
 

Top