• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Symbolic Links in Snow Leopard
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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


  • Follow-Ups:
    • Re: Symbolic Links in Snow Leopard
      • From: Jens Alfke <email@hidden>
  • Prev by Date: Re: Get error message about registered observers when Object receives dealloc message
  • Next by Date: How to stop NSImage from resizing while calling 'drawInRect' ?
  • Previous by thread: Re: Should we release a CGImage created from NSBitmapImageRep ?
  • Next by thread: Re: Symbolic Links in Snow Leopard
  • Index(es):
    • Date
    • Thread