Symbolic Links in Snow Leopard
Symbolic Links in Snow Leopard
- Subject: Symbolic Links in Snow Leopard
- From: "Gerriet M. Denkmann" <email@hidden>
- Date: Sun, 6 Sep 2009 20:15:44 +0700
I am trying to replace the deprecated fileSystemAttributesAtPath:
1. Although Kyle Sluder stated:
The header file describes the correct behavior.
The current behavior is the only one that makes sense.
I am a bit troubled by the documentation stating that "This behavior
may change in a future version of the Mac OS X.".
I would really very much like an official statement from Apple
(although I fully agree with Kyle's statements).
But to get to the point:
If I need to replace this:
a = [ fm fileAttributesAtPath: path traverseLink: YES];
then an obvious replacement would be:
a = [ fm attributesOfItemAtPath: [path stringByStandardizingPath]
error: NULL];
The problem is: neither stringByStandardizingPath (which is documented
to remove symlinks) nor stringByResolvingSymlinksInPath does anything.
Well, they are documented to return self if an error occurs, but I
cannot find any error messages in my console.log.
This is the directory used (/Volumes/เม่น/Users/gerriet/
Downloads):
-rw-r--r--@ 1 gerriet staff 36 6 Sep 19:30 abc
-rw-r--r--@ 1 gerriet staff 47908 6 Sep 19:37 abc alias
lrwxr-xr-x 1 gerriet staff 3 4 Sep 21:31 abcSymlink -> abc
lrwxr-xr-x 1 gerriet staff 49 6 Sep 19:45 absAbsSymlink -> /
Volumes/เม่น/Users/gerriet/Downloads/abc
Here is my code:
NSLog(@"%s start \"%@\"",__FUNCTION__, pat1);
NSString *pat2 = [ pat1 stringByTrimmingCharactersInSet:
[ NSCharacterSet whitespaceAndNewlineCharacterSet ] ];
NSLog(@"%s removed white: \"%@\"",__FUNCTION__, pat2);
NSString *pat3 = [ pat2 stringByStandardizingPath ];
NSLog(@"%s standardized \"%@\"",__FUNCTION__, pat3);
And this is the result:
start "/Volumes/เม่น/Users/gerriet/Downloads/absAbsSymlink"
removed white: "/Volumes/เม่น/Users/gerriet/Downloads/
absAbsSymlink"
standardized "/Volumes/เม่น/Users/gerriet/Downloads/
absAbsSymlink" <-- BAD
What am I doing wrong?
Kind regards,
Gerriet.
_______________________________________________
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