Alex Rivera | Logout

How do I detect whether the file system is case-sensitive?

Asked 2009-08-17T13:58:54.317
17

I have a List<String> of file names from a folder and a certain file name as String. I want to detect whether the file name is in the list, but need to respect the underlying file system's property of whether it is case-sensitive.

Is there any easy way to do this (other than the "hack" of checking System.getProperty("os.name", "").toLowerCase().indexOf("windows")!=-1)? ;-)

Edit
Report

2 Answers

12

Don't use Strings to represent your files; use java.io.File:

http://java.sun.com/javase/6/docs/api/java/io/File.html#equals(java.lang.Object)

answered 2009-08-17T14:15:28.880
2

It looks like you can use the IOCase.

answered 2010-12-02T03:39:46.513

Your Answer