• 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
NSFileTypeAlias available?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

NSFileTypeAlias available?


  • Subject: NSFileTypeAlias available?
  • From: Lorenzo <email@hidden>
  • Date: Wed, 26 Nov 2003 22:45:35 +0100

Hi List,
I use to get the fileAttribute and understand whether a file is symLink with

fileType = [itemAttribute objectForKey:@"NSFileType"];
if(fileType == NSFileTypeSymbolicLink)

is a similar Cocoa way to know whether a file is an alias?
Is something like NSFileTypeAlias?
Actually I use the old Carbon way. But as you can figure out, I have firstly
to translate the NSString pathname to FSRef then resolve the alias if it is
an alias then convert back the FSRef to the NSString.
But warning! When trying to get the FSRef from

err = FSPathMakeRef([*sourceItem fileSystemRepresentation],
&sourceRef, NULL);

if the source file is really a symLink, FSPathMakeRef traverses the source
file and returns the FSRef of the target file and not the FSRef of the
source file itself. To workaround the problem
I have to build the FSRef using the parent folder of the source file

err = FSMakeFSRefUnicode(&sourceParentRef, sourceFileName.length,
sourceFileName.unicode, kTextEncodingFullName, sourceRef);

I know this could be even not a great problem, but please think in a loop of
100,000 files this is a waste of time.
Any faster solution?


Best Regards
--
Lorenzo
email: email@hidden
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.

  • Prev by Date: Re: Regex lib for NSString ?
  • Next by Date: Re: NSMatrix and Uninitialized rectangle
  • Previous by thread: Changing the Appearance of NSScroller
  • Next by thread: Re: NSFileTypeAlias available?
  • Index(es):
    • Date
    • Thread