Re: Symbolic Links in Snow Leopard
Re: Symbolic Links in Snow Leopard
- Subject: Re: Symbolic Links in Snow Leopard
- From: Joar Wingfors <email@hidden>
- Date: Sun, 6 Sep 2009 17:17:11 -0700
On 6 sep 2009, at 14.26, Jens Alfke wrote:
NSLog(@"path = %@", [@"/etc" stringByStandardizingPath]);
results in
path = /etc
when the result ought to be "/private/etc".
This is the documented behavior:
"Remove an initial component of “/private” from the path if the
result still
indicates an existing file or directory (checked by consulting the
file system)."
The same thing happens with a custom symlink I created, like "/
Code", which links to "/Volumes/snoog/Code":
NSLog(@"path = %@", [@"/Code/Murky" stringByStandardizingPath]);
results in
path = /Code/Murky
The documentation is less clear on this. It says:
"If stringByStandardizingPath detects symbolic links in a pathname, the
stringByResolvingSymlinksInPath method is called to resolve them."
...but also:
"Note that the path returned by this method may still have symbolic
link components in it."
I would suspect that the first comment is incorrect, and that this
method simply isn't attempting to resolve all symbolic links. The high
level description of the method certainly doesn't give that impression:
"Returns a new string made by removing extraneous path components
from the receiver."
Compare that with the high level description for -
stringByResolvingSymlinksInPath:
"Returns a new string made from the receiver by resolving all
symbolic links and standardizing path."
j o a r
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden