• 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: Brian Webster <email@hidden>
  • Date: Thu, 11 Apr 2002 16:50:03 -0500

On Thursday, April 11, 2002, at 02:22 PM, Andreas Schwarz wrote:

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.

I guess that makes sense, since the FSRef theoretically contains the unique HFS+ file ID for the file, where as the URL needs to be parsed and all the subfolders traversed to find the actual file. Of course, NSFileManager has to do the same thing with the path, and it's not so slow. I wonder if it uses the LS* functions at all, or if it accesses the information directly.

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?

There's another parameter you can pass in, the "with properties" parameter in Applescript, where you can pass in a record with values for various properties of the item, including its name. So, you'll want to:

1. Create a record descriptor. You do this by using AECreateList() and passing true to the isRecord argument.
2. Create a descriptor for the name. You'll probably want to make it of typeUnicodeText and pass in a buffer of unichars for the data.
3. Use AEPutKeyDesc() to put the name descriptor into the record under the keyword pName.
4. Set the record as the keyAEPropData parameter of the Apple event.

You can add any other properties you might like to set in the record as well. AERegistry.h and FinderRegistry.h have the codes for the keywords to use.

--
Brian Webster
email@hidden
http://homepage.mac.com/bwebster
_______________________________________________
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.

References: 
 >Re: Symbolic links, alias files and related stuff (From: Andreas Schwarz <email@hidden>)

  • Prev by Date: Undo in tables
  • Next by Date: Re: AppleScipt & Cocoa, argh! I can't get it to work
  • Previous by thread: Re: Symbolic links, alias files and related stuff
  • Next by thread: Problem with submenus
  • Index(es):
    • Date
    • Thread