开发者

File deletion fails sometimes on Mac

Technical Q&A 1497 and this question (whose answer copied from the tech note) indicate that, when getting fBsyErr from FSDeleteObject, the proper workaround is to call FSUnlinkObject on 10.5+.

What is the technical difference between the two APIs FSDeleteObject and FSUnlinkObject (other than noting that FSUnlinkObject does not appear in the documentation)? Why should unlink be the fallba开发者_C百科ck and not the primary API?


I'd guess that FSDeleteObject came first because it continues a line of file-deletion functions that existed long before the Mac OS merged with Unix, whereas unlinking a file is a Unix concept.


The Apple document you linked explains the difference quite clearly. FSUnlinkObject has the same semantics as unlink() - deleting open files is allowed. FSDeleteObject does not allow deleting open files and returns that error code when you attempt to do so.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜