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