Avoid changing/moving file that's currently being written.
Fabian Schuiki <[email protected]>
| Newsgroups | gmane.comp.macosx.devel |
|---|---|
| Message-ID | <[email protected]> |
Hi! I'm working on a daemon that may change and move files in the background at random moments. Now I'd like to prevent the daemon from tampering with files that are currently being written by another app, copy operation whatever have you. With the Finder itself it's not that difficult, as it creates a 0-sized placeholder file of a special type until the copy is done, at which instance the placeholder is swapped for the real thing. Just avoid moving the special files and you're good. But lower level commands like cp don't do any of this, yet I'd rather be able to not interfere with that too! So how do you do that? Is there some kind of reference count that is being kept by the system for files? Cheers and thanks in advance, Fabian Fabian Schuiki [email protected]