{I earlier posted this to darwin-userlevel but was advised this would be a 
better place to ask.}

Is there any way to create an alternative path to a directory, that will remain 
valid even if the directory is moved?

Here’s my issue: I’m using a 3rd party database library [not sqlite!] that is 
heavily reliant on paths, to the extent that it gets extremely confused if you 
move database files while they’re open. This conflicts with my wanting to use 
such databases in (bundle-based) Mac OS documents, which the user could locate 
in the Finder and drag to another folder at any time. The best workaround I can 
think of is to give the database some alternative path that points to the doc 
bundle dir but will still work even after the directory is moved.

Now, FSRefs aren’t paths but they also have the property that they work even 
when a directory is moved. I dimly remember from the early days of OS X that 
there was a form of path used internally by FSRefs, something like 
“/.volfs/dirid” where ‘dirid’ is the numeric HFS directory ID. Does this still 
work?

Otherwise, the only other way I can think of is to create a hard-link to the 
directory at some temporary location and use that path instead. [But I’ve been 
told that hard-linking dirs isn’t possible in general, only on Time Machine 
backup volumes.]

(There’s also the option of watching FSEvents to notice when the directory has 
been moved. There are obvious race conditions associated with this, though; I’m 
not going there.)

—Jens
 _______________________________________________
Do not post admin requests to the list. They will be ignored.
Filesystem-dev mailing list      (Filesystem-dev@lists.apple.com)
Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/filesystem-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Reply via email to