zho*_*shu 3 java windows filesystems
在Windows OS中,我有一个文件,例如"README".
使用java, File("readme").exists()将返回true
如何获取真正的文件名,如下所示:
new File("readme").getTrueFileName() //return "README"
Run Code Online (Sandbox Code Playgroud)
看看File.getCanonicalPath- 返回"真实"文件名.
还有File.getCanonicalFile返回相同信息但作为File对象的信息.
(我刚刚根据你的具体情况测试了它,它运行正常.)