• 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: .webloc files and Safari (newbie)
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: .webloc files and Safari (newbie)


  • Subject: Re: .webloc files and Safari (newbie)
  • From: jay <email@hidden>
  • Date: Mon, 08 Dec 2003 12:07:00 -0800

thanks for all the help. i started on some code last night that'll extract the data i need from the resource fork and convert it to an NSString. i didn't want to have to touch on carbon but it looks like it's the only way to do it currently.

-j

Jirome Foucher wrote:

On 8 dic. 03, at 14:26, Gregory Weston wrote:

On Dec 8, 2003, at 1:00, email@hidden wrote:

On Sunday, December 7, 2003 at 11:20 PM, jay wrote:

Working on a simple droplet as an excersize and I want it to be able to
accept drags from Safari. I assumed that the .webloc files you get when
you drag a url from Safari to the Finder would contain a string of the
url. But they're 0 byte files. How exactly do these work?

Are you looking in the resource fork or the data fork? I think Webloc
files store there info in the resource fork.


No, the contents are in the data fork (as would make sense, given that Apple is to all appearances trying to deprecate the resource fork). They're also much more than just the URL, though. I just grabbed one and the first 256 bytes are almost all zeroes. Then there's 56 more bytes of mostly inobvious information. Then the URL, a couple extra bytes, the URL again and several more mostly-unreadable bytes. You know what it looks like? An alias record, IIRC.


No sorry, it's not an alias record
It's a flattened resource fork (the resource fork is just dumped into the data fork). Just open the file using FSOpenResourceFile to access it as a resource fork.

If I drag an URL from Safari to my desktop, I can see three ressources inside :
One "TEXT" which is the URL as a C string
One "url " which is also the URL as a C string
One "drag" which is a structure describing which ressources are present in the fork.

If you're familiar with Mac OS 9's URL clippings, it's the exact same format, except it's stored in the data fork instead of the resource fork.

You cannot access the content using Cocoa. You need Carbon to deal with ressources.

Hope this helps
Jirome
_______________________________________________
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.
_______________________________________________
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: .webloc files and Safari (newbie)
      • From: Nick Zitzmann <email@hidden>
References: 
 >Re: .webloc files and Safari (newbie) (From: Gregory Weston <email@hidden>)
 >Re: .webloc files and Safari (newbie) (From: Jérome Foucher <email@hidden>)

  • Prev by Date: How to use a custom field editor in a System Pref panel?
  • Next by Date: NSDocument with documents being folders
  • Previous by thread: Re: .webloc files and Safari (newbie)
  • Next by thread: Re: .webloc files and Safari (newbie)
  • Index(es):
    • Date
    • Thread