java – file. canWrite(); file. canRead(); file. canExceute(); Although my file / directory does not have access rights, it always returns true
•
Java
I need to check the permissions of the files / directories I use
//filePath = path of file/directory access denied by user ( in windows ) File file = new File(filePath); file.canWrite(); file.canRead(); file.canExecute();
All three return true, but no files / directories can be deleted
Solution
You must check:
SecurityManager.checkDelete(filepath);
As described in Javadoc
The content of this article comes from the network collection of netizens. It is used as a learning reference. The copyright belongs to the original author.
THE END
二维码