 |
 |
File Extension mapping
|
 |
|
 |
|
Fresh-Faced Recruit
Join Date: Apr 2001
Location: Cairo, Egypt
Status:
Offline
|
|
Assalamu 3alaikum,
I am trying to make my application register a certain extension in the system registry such that it extension maps to my application. Meaning if the file is of extension .dos for example, then the system would use my application to open it should it be double clicked (like in File Exchange in Classic.) The file will not have the type or creator set since it will be a file copied from another OS. I knoe that InternetConfig is the library that deals with this sort of thing, but I am lost. I've tried many functions and they don't seem to work. Can you advise?
|
|
|
| |
|
|
|
 |
|
 |
|
Dedicated MacNNer
Join Date: Jan 2001
Location: Virginia, US
Status:
Offline
|
|
Just make sure that your app properly declares the fact that it handles .dos files. If it is, and your app is installed in one of the standard Application directories (or in a subdirectory of them), then the system should know about your app (you may need to log out and back in).
If there's no creator or file type, then the extension is looked at. If yours is the only app that has declared it handles that extension, that app will be used. If there is more then one app that declares it, it's a user preference really. Open up the inspector -- er, Show Info -- on the file, and look at the Applications pane. You should be able to select your app as being the one to use.
You should be able to select your app even if you haven't properly declared the fact that it accepts .dos extensions, though you'll have to specify "All Applications" instead of "Recommended Applications" on the panel that comes up when you click "Choose Application" from the Show Info panel.
|
|
|
| |
|
|
|
 |
|
 |
|
Dedicated MacNNer
Join Date: Apr 2001
Location: San Francisco, USA
Status:
Offline
|
|
I think your application's info.plist file is the place to put extension mappings. Use "show package contents" in the Finder and look at the info.plist files of other applications for some examples. Project Builder and OmniWeb both register themselves for quite a few file types.
To set up the info.plist for your app, first click on your project's target in Project Builder. This should show your target settings. I think the file type stuff is in under the third tab, near the bottom.
|
|
|
| |
|
|
|
 |
|
 |
|
Fresh-Faced Recruit
Join Date: Apr 2001
Location: Cairo, Egypt
Status:
Offline
|
|
Assalamu 3alaikum,
Well here are my comments. As for changing the opening application from the inspector, the problem with that is that the application will be set to open just that file. My objective however is to make any file with a certain extension open with a certian applications. Furthermore, I don't want to user to do that himself; I want to application to make that mapping for him.
I do believe my application maps the extension correctly. The application basically creates and ICMapEntry and then sets the extension at the "extension" field and the application at the "creatorAppName" in addition to other settings. Then I add that entry with ICAddMapEntry().
Also, my ptoject is developed in C++ with CodeWarrior. I am not using ProjectBuilder and hence I don't really have a package file.
Waiting for your responses.....
|
|
|
| |
|
|
|
 |
|
 |
|
Fresh-Faced Recruit
Join Date: Apr 2001
Location: Cairo, Egypt
Status:
Offline
|
|
I also forgot to mention sth. When I try to change the generic application from the inspector, and I choose my application, it gives me a message "The operation could not be completed. An unexpected error occured (error code -10820.) If I am not allowed to do this simple change manually, then I definitely cannot do it through API from my application. BIG PROBLEM. Please advise.
|
|
|
| |
|
|
|
 |
|
 |
|
Forum Regular
Join Date: Sep 2000
Status:
Offline
|
|
Originally posted by okandeel:
Assalamu 3alaikum,
Well here are my comments. As for changing the opening application from the inspector, the problem with that is that the application will be set to open just that file. My objective however is to make any file with a certain extension open with a certian applications. Furthermore, I don't want to user to do that himself; I want to application to make that mapping for him.
I do believe my application maps the extension correctly. The application basically creates and ICMapEntry and then sets the extension at the "extension" field and the application at the "creatorAppName" in addition to other settings. Then I add that entry with ICAddMapEntry().
Also, my ptoject is developed in C++ with CodeWarrior. I am not using ProjectBuilder and hence I don't really have a package file.
Waiting for your responses.....
As other people have pointed out, you have to do this in your Info.plist file. You can list both extensions and/or types that your app is interested in. You don't do this in InternetConfig.
If you are not a packaged application, you can still take the Info.plist and put it somewhere in a resource fork, I think. I am not sure of the details on that though.
Ali
|
|
|
| |
|
|
|
 |
|
 |
|
Fresh-Faced Recruit
Join Date: Apr 2001
Location: Cairo, Egypt
Status:
Offline
|
|
Assalamu 3alaikum,
Well then how can I package my carbon application into a bundle. I am assuming when I do that, the application can be invoked normally and should a file with my desired extension be clicked, the bundle will invoke my carbon application to open it. But how can I package my carbon application into a bundle?
|
|
|
| |
|
|
|
 |
|
 |
|
Dedicated MacNNer
Join Date: Nov 2000
Location: Trolling for Meader
Status:
Offline
|
|
Originally posted by okandeel:
Well then how can I package my carbon application into a bundle. I am assuming when I do that, the application can be invoked normally and should a file with my desired extension be clicked, the bundle will invoke my carbon application to open it. But how can I package my carbon application into a bundle?
For a CFM app you should use a 'plst' resource instead of Info.plist, see:
http://developer.apple.com/technotes/tn/tn2013.html
|
|
|
| |
|
|
|
 |
|
 |
|
Fresh-Faced Recruit
Join Date: Apr 2001
Location: Cairo, Egypt
Status:
Offline
|
|
Assalamu 3alaikum,
Well what I don't understand is what would I do with the resource after that. I have it in XML format and I have the creator inside set to my application and I have the extension also set properly. But how do I tell the Finder to use this resource so that it knows to use my application to open the required extension. It is this link that I don't know.
I can have a data reference of the XML file inside my code anyway through the Property List API. But my problem is how to 'register' or 'install' it after it's created so that my extension would be recognized as opened by my application. InternetConfig works on Classic, but obviously not in Carbon.
|
|
|
| |
|
|
|
 |
|
 |
|
Fresh-Faced Recruit
Join Date: Apr 2001
Location: Cairo, Egypt
Status:
Offline
|
|
Assalamu 3alaikum,
Ok I made a plst resource and gave it an ID of 0. Inside it I pasted XML definitions one of which is the Document types that the application can open. Do I need to further enforce this with certain calls? Are there certain keys that I must make sure I don't forget in the plst? I'm frankly lost...
|
|
|
| |
|
|
|
 |
|
 |
|
Fresh-Faced Recruit
Join Date: Apr 2001
Location: Cairo, Egypt
Status:
Offline
|
|
I added a bundle resource like someone suggested. There is only one problem. There is nothing in there for extensions or file suffices. You can only specify types and creators. How then does OS X recognizes a file extension and opens the proper application???
I haven't been getting answers...hope no one is ignoring me...hmmmmm
|
|
|
| |
|
|
|
 |
|
 |
|
Fresh-Faced Recruit
Join Date: Apr 2001
Location: Cairo, Egypt
Status:
Offline
|
|
well just to let you know what my problem was, the problem was that the application had to be installed in a Mac OS X partition. My application was installed in another partition but I thought it would still be recognized by Mac OS X. Just thought I would share.
|
|
|
| |
|
|
|
 |
 |
|
 |
|
|
|
|
|

|
|
 |
Forum Rules
|
 |
 |
|
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
|
HTML code is Off
|
|
|
|
|
|
 |
 |
 |
 |
|
 |
|