site_archiver@lists.apple.com Delivered-To: Darwin-kernel@lists.apple.com Thread-index: AcafsNorlmcU9mW4TGqSYiStUbYI8AACfYdQ Um, no it's not portable. Even I can copy the file to a non-Mac machine I can't do anything with it. If I double-click on a .webloc file on a Windows machine, nothing will happen. If I double-click on a .url file on a Mac, it will open. This is because, for once, Microsoft did the right thing and stores web links in plain text files that can be read anywhere, whereas Apple is using a proprietary solution that adds absolutely no value. In any event, the question was not how do I read the data out of the resource fork. I've already figured out how to do that using some cockamamie Carbon API. The question is, given the parameters of what I'm trying to do, what's the best way to receive a notification when a file of a particular type is created (or closed)? I don't want to preserve the fork, I want to delete it and replace it with a simple, elegant, cross-platform, human-readable text file. Bruce -----Original Message----- From: Dan Shoop [mailto:shoop@iwiring.net] Sent: Tuesday, July 04, 2006 5:29 PM To: Bruce Fancher; Darwin-kernel@lists.apple.com Subject: Re: Advice wanted on how to proceed . . . At 1:31 PM -0400 7/4/06, Bruce Fancher wrote:
Hi. I posted a kind of generic question a month or two ago about communication between kernel- and user-space and got some responses which were very helpful. However, before I continue my investigation, I wanted to briefly describe what I'm trying to do and make sure I'm on the right track so I don't waste any time on the wrong approach(es).
Very briefly: When you drag a URL from Safari to the Finder it saves the link as a .webloc, which is an empty file with the URL and title of the page in a resource fork.
The file's not an empty file, it's just an empty data fork.
I find this annoying because it's antiquated and non-portable.
You find this annoying b/c you don't realize a Macintosh file is defined as having a mandatory two streams (forks) of data, either of which may be zero length. That is the information *is* stored in the file. It's stored in one of three forks you commonly see under Tiger, two of which *always* exist if it's a Macintosh file. Moreover it's already completely portable - In BSD it's referenced as filename/..namedfork/rsrc. - If the file is copied from HFS+ to elsewhere it is copied as a Apple Double, which is also completely portable
I check my bookmarks into Subversion to sync them across different machines, so this doesn't work for me.
Then subversion is broken in that it does not read/write Macintosh files. It discards necessary data and metadata that is meant to be preserved. This should be split as an Apple Double on foreign machines. Have you looked for ._file's? Have you tried including */..namedfork/rsrc ??
I wrote a little utility to walk through a directory tree and replace any .webloc files it finds with .url (Microsoft IE) files, which are simply text files. Since double-click on a .url file on a Mac will open the link in Safari, this has worked just fine for me.
Nice solution, I suppose. But why not just store them on a non-HFS+ volume and they'll properly split into Apple Doubles. Or just use SplitForks.
What I want to do now is automate the process so that whenever I save a link anywhere in the filesystem, it's automatically converted into a .url file. I'd lookeed into writing a kernel extension that uses the kauth API to be notified whenever a .webloc file is closed, and then notify a user-space process of the location of the file so that it can read it and replace it with a .url file. However, it also seems I could just write a Spotlight importer and not mess with the kernel at all.
Seems like a lot of trouble when the more proper solution already exists. Namely maintain the fork like you should be. -- -dhan ------------------------------------------------------------------------ Dan Shoop AIM: iWiring Systems & Networks Architect http://www.ustsvs.com/ shoop@iwiring.net http://www.iwiring.net/ 1-714-363-1174 pgp key fingerprint: FAC0 9434 B5A5 24A8 D0AF 12B1 7840 3BE7 3736 DE0B iWiring provides systems and networks support for Mac OS X, unix, and Open Source application technologies at affordable rates. _______________________________________________ Do not post admin requests to the list. They will be ignored. Darwin-kernel mailing list (Darwin-kernel@lists.apple.com) Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/darwin-kernel/site_archiver%40lists.a... This email sent to site_archiver@lists.apple.com