File-system case sensitivity

J

Jeffrey Schwab

Is there a decent way to check whether an application's local
file-system is case sensitive?
 
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.
 
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.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,755
Messages
2,569,536
Members
45,019
Latest member
RoxannaSta

Latest Threads

Top