Welcome to the MacNN Forums.

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

You are here: MacNN Forums > Software - Troubleshooting and Discussion > Developer Center > Cocoa File Types

Cocoa File Types
Thread Tools
Grizzled Veteran
Join Date: Jun 2002
Status: Offline
Reply With Quote
Apr 30, 2004, 12:40 PM
 
Hey guys,

Here is what I would like, perfectly:

When a user clicks save, they can enter any file name they want, but when they do, I also want to be able to open the file they just saved, in Xcode where I set file types, if I leave it blank, it won't let me open any files whatsoever. So basically, I want to be able to open any file type. Also, I would like to be able to set my application as the default for opening a few file types like html, or php. And if not default, atleast put it in the list. I have tried this:

<key>LSIsAppleDefaultForType</key>
<true/>

But it doesn't seem to want to work.

Any help is appreciated, thanks
Oliver
     
Mac Elite
Join Date: Feb 2001
Location: Vancouver, WA
Status: Offline
Reply With Quote
Apr 30, 2004, 03:10 PM
 
You can accept any filetype for opening by entering * for extensions and **** for HFS types. Beware that if you do this you'll likely want to add extra logic to verify that a file the user is trying to open is something you can actually read -- once you've declared that you accept any filetype, the user will be able to drag anything onto your Dock icon.

The user can choose to make your application the default for HTML (or whatever file type) using the Open With section of the Finder's Get Info / Inspector window. There isn't a public API allowing third-party software to do this, probably because Apple doesn't want the user experience to become inconsistent and doesn't want to to open the door for applications to start hijacking each others' files without the user's permission.

If you declare support for ".html", ".php", etc, your application should show up in Open With menus... you might not see it there right away if you're using a development build of your app (Launch Services caches app registrations by path, and doesn't always know to update them as you build and rebuild your app in Xcode/PB). Copy a build elsewhere and run it once, log out and back in, and you should be assured of seeing the proper info.
Rick Roe
icons.cx | weblog
     
   
Thread Tools
Forum Links
Forum Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On
Top
Privacy Policy
All times are GMT -5. The time now is 06:28 PM.
All contents of these forums © 1995-2011 MacNN. All rights reserved.
Branding + Design: www.gesamtbild.com
vBulletin v.3.8.7 © 2000-2011, Jelsoft Enterprises Ltd., Content Relevant URLs by vBSEO 3.3.2