更新时间:2022-04-15 07:52:46
这也会检查目录是否存在.
This would check for the existance of the directory as well.
File file = new File("c:\cygwin\cygwin.bat");
if (!file.isDirectory())
file = file.getParentFile();
if (file.exists()){
...
}
似乎 file.canWrite() 没有明确指示您是否有权写入目录.
It seems like file.canWrite() does not give you a clear indication if you have permissions to write to the directory.