Mailing Lists: Apple Mailing Lists

Image of Mac OS face in stamp
 
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Is OS still working with files after an FSExchangeObjects call?



I'm going to go out on a limb and blame Spotlight, since this is typically the reason why a newly-added file cannot be deleted and fBsyErr is returned.
Try using the OS call "unlink" instead, as this will work even if another process has the file open.


On Aug 1, 2007, at 1:29 PM, Tolu Fapohunda wrote:

Hello,

I am trying to implement a "save" mechanism. I want the "save" mechanism to be safe (I dont want to corrupt the user's data) - so, I create a temporary file, write to the temporary file, swap the contents of the temporary file with the real file the user saved to, then delete the temporary file.

Now, I am swapping the contents of 2 files using FSExchangeObjects (...). FSExchangeObjects returns no error, however, sometimes when I try to delete the unwanted (temp) file, I get a fBsyErr [File is busy (delete)]. Is the OS still doing something with the file(s) after they are exchanged? This seems to happen once every 3 times I call FSExchangeObjects.

Both files are guaranteed to always in the same directory. Any advice appreciated?

Thanks in advance,
Tolu
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Carbon-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/carbon-dev/jstiles% 40blizzard.com


This email sent to email@hidden

_______________________________________________ Do not post admin requests to the list. They will be ignored. Carbon-dev mailing list (email@hidden) Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/carbon-dev/email@hidden

This email sent to email@hidden
References: 
 >Is OS still working with files after an FSExchangeObjects call? (From: "Tolu Fapohunda" <email@hidden>)



Visit the Apple Store online or at retail locations.
1-800-MY-APPLE

Contact Apple | Terms of Use | Privacy Policy

Copyright © 2007 Apple Inc. All rights reserved.