开发者

How to determine if the requested directory is writable? [duplicate]

This question already has answers here: Closed 11 years ago.

Possible Duplicate:

How do you check for permissions to write to a directory or file?

I'm trying to figure out if i开发者_C百科t is possible to determine if a requested file directory is writable and the current user have the right permissions to write into that folder.

Till now I'm making a test for the requested path by creating new directory, writing a temp file into it and remove it (the temp file and directory).

This operation is very problematic since that directory may be exist already and all of its old information can be lost (when the directory remove).

Any idea ?? Tx...


The best approach is to attempt the operation and let the system decide whether or not it is allowed. Duplicating the checks that the system performs would be terribly hard to get right. Just let the system decide, it is the ultimate arbiter.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜