In Windows os, I have a file, for example "README" .
Using java, File("readme").exists()
will return true
How to get the true file name, something like this:
new File("r开发者_StackOverfloweadme").getTrueFileName() //return "README"
Look at File.getCanonicalPath
- that returns the "real" filename.
There's also File.getCanonicalFile
which returns the same information but as a File
object.
(I've just tested this with your exact situation, and it works fine.)
You could try File.getCanonicalPath
. I don't have a Windows box to test this on, so it's just a stab in the dark.
精彩评论