سؤال

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 fallback 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.

مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top