Re: Filesystem path that works even after a dir is moved?
Re: Filesystem path that works even after a dir is moved?
- Subject: Re: Filesystem path that works even after a dir is moved?
- From: "Quinn \"The Eskimo!\"" <email@hidden>
- Date: Tue, 03 Nov 2015 08:19:55 +0000
On 2 Nov 2015, at 19:59, Jens Alfke <email@hidden> wrote:
> 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?
The underlying infrastructure is still there but it doesn't work in exactly the same way and thus is not going to be useful to you (and it was never documented as API anyway, so using it in your app would be a mistake).
> Is there any way to create an alternative path to a directory, that will remain valid even if the directory is moved?
If you chdir into the directory than relative paths will be evaluated relative to that directory. The problem, obviously, is making sure that the chdir is in place every time you call the library.
There is a per-thread current working directory facility (__pthread_chdir), which might help with the above, but it's not public API )-:
You could modify the library to use <x-man-page://2/openat> and friends.
Share and Enjoy
--
Quinn "The Eskimo!" <http://www.apple.com/developer/>
Apple Developer Relations, Developer Technical Support, Core OS/Hardware
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Filesystem-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden