Re: Symbolic Links in Snow Leopard
Re: Symbolic Links in Snow Leopard
- Subject: Re: Symbolic Links in Snow Leopard
- From: Greg Guerin <email@hidden>
- Date: Sun, 6 Sep 2009 13:26:45 -0700
Gerriet M. Denkmann wrote:
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
Try using a pathname that contains only Latin alphabet characters
(for reference, the original chars of the volume-name are Thai: \u0e40
\u0e21\u0e48\u0e19). If necessary, create and mount a disk-image in
order to get only Latin chars.
Also, please show the code that assigns a value to pat1. How that
pathname is determined may have a bearing on the problem.
Finally, I'm a little puzzled why stringByTrimmingCharactersInSet:
should be needed. Maybe the problem lies with the pathname itself,
and trimming its whitespace turns it into a pathname that doesn't
exist. For visibility, you might want to display every char of the
original pat1 that's outside the range 0x21-0x7E as a \Uxxxx value.
There may also be an encoding you could use, non-lossy ASCII.
You should be able to do a file-system function on the standardized
pathname pat3 and have it tell you it's a symlink (e.g. stat()). If
there's no file-system object for the pathname, then that tells you
something.
-- GG
_______________________________________________
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