Re: FSPathMakeRef and Symlinks
Re: FSPathMakeRef and Symlinks
- Subject: Re: FSPathMakeRef and Symlinks
- From: Rainer Brockerhoff <email@hidden>
- Date: Thu, 20 Dec 2001 12:48:03 -0200
>
Date: Wed, 19 Dec 2001 22:44:26 -0800
>
From: Steve Gehrman <email@hidden>
>
>
FSPathMakeRef follows symlinks and I don't want that behavior, is there
>
a way to create a FSRef that does not follow symlinks?
I ran into that problem in XRay. If you're concerned just about the last item being a symlink, you can do what I did.
I check if the the item is a symlink with lstat(). If not, I call FSPathMakeRef normally. If it's a symlink, I split the path into parent folder and item, use FSPathMakeRef to get the parent folder's FSRef, then call FSMakeFSRefUnicode to get the symlink's FSRef. (You'll also need to call FSGetCatalogInfo to get the encoding to pass to FSMakeFSRefUnicode.)
Now, if you don't want to follow any symlinks at all anywhere in the path, you'll have to do this at all steps in the path...
HTH,
--
Rainer Brockerhoff <email@hidden>
Belo Horizonte, Brazil
"Originality is the art of concealing your sources."
http://www.brockerhoff.net/ (updated Dec. 2001)