• 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
Re: Symbolic links, alias files and related stuff
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Symbolic links, alias files and related stuff


  • Subject: Re: Symbolic links, alias files and related stuff
  • From: Andreas Schwarz <email@hidden>
  • Date: Thu, 11 Apr 2002 12:22:46 -0700

Hmm, I just did a little test and LSCopyDisplayNameForRef() seems to be twice as slow as [[NSFileManager defaultManager] displayNameForPath:]. Maybe it's using something else?

How does LSCopyDisplayNameForURL() fare? Is it any faster?

Oh, hell no. I just did a lot of testing of all the LS functions I use a lot, and it seems the FSRef ones are on average 4 times as fast as the URL ones. Maybe I'm doing something wrong though. In any case, here's the results of my (very informal) testing in this case (it seems the results I got earlier weren't quite so accurate; NSFileManager is faster, but not by too much):

Using FSRef: 1.569345 seconds
Using URL: 4.762220 seconds
Using NSFileManager: 1.441965 seconds

These are being called 9000 times each on my "Pictures" folder. The two functions I'm using besides NSFileManger's method (if there's anything stupid here, please tell me!):

static NSString * getDisplayName1(NSString *path) {
FSRef ref;
CFStringRef name;

if ((FSPathMakeRef([path fileSystemRepresentation], &ref, NULL) != noErr) || LSCopyDisplayNameForRef(&ref, &name) != noErr) {
return [path lastPathComponent];
}

return [(NSString *)name autorelease];
}
static NSString * getDisplayName2(NSString *path) {
CFStringRef name;

if (LSCopyDisplayNameForURL((CFURLRef)[NSURL fileURLWithPath:path], &name) != noErr) {
return [path lastPathComponent];
}

return [(NSString *)name autorelease];
}


I think the Finder's a little schizo. :)

Seems like it ;-). Is there any way I can specify names for the new files myself? Or perhaps get a hold of the newly created file (AppleEvents can return stuff, I know, but I have no idea how or what to do) and rename it afterwards?

Thanks again,
Andreas Schwarz
http://homepage.mac.com/schwarz
_______________________________________________
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.

  • Follow-Ups:
    • Re: Symbolic links, alias files and related stuff
      • From: Brian Webster <email@hidden>
  • Prev by Date: Printing question
  • Next by Date: Re: Creating a checkbox
  • Previous by thread: Re: Printing question
  • Next by thread: Re: Symbolic links, alias files and related stuff
  • Index(es):
    • Date
    • Thread