On Oct 20, 2011, at 12:58 PM, John Joyce wrote: >>>> >>>>> Hello I have an application that is able to process .txt files, >>>>> which can be opened using File->Open and saved with File->Save, >>>>> File->Save As. The problem is that Finder thinks that my >>>>> application is an app that the user may want to open by double >>>>> clicking a text file. How does it do it? And how could I prevent >>>>> OS X from adding my application to the list "Open With" of the >>>>> context menu of txt files? Thank you >>>> >>>> Take .txt out of your plist, subclass [NSDocumentController >>>> runModalOpenPanel:forTypes:] to add "txt" to the types it can >>>> open, and (I think; I haven't done this) [NSDocument >>>> fileNameExtensionForType:saveOperation:] for save - if not, that's >>>> a starting point._______________________________________________ >>> >>> May I also ask why you would want to do this? I would generally expect >>> that if an application lets me open and save a format via the menus that >>> I would also be able to open it through Finder. >> >> In our case, long ago we used an extension - "cfg" - that's unfortunately >> very common. We changed it before we ever had a Mac app, so the only "cfg" >> files on a Mac are either very old and copied from another OS, or should be >> opened by some other app. The handful of people who do have old files are >> happy enough with having to go through File->Open and the vast number of >> other people are happy that double-clicking their "cfg" files doesn't open >> our app. >> >> That's why I don't know about the save options - we don't save this format >> :)_______________________________________________ > > You might want to look at implementing an "import" function and not declaring > this file type as a document you open. > That will be the most graceful way and will guid your customers into > converting the file to the modern types you prefer them to use. > All you really need to do is implement the logic under that to identify the > file type is correct and read it in, without declaring a UTI or anything at > an app level.
"Import" has a different meaning in our app that is not applicable to this particular file type, but that's pretty much what we do - it's a file that we can open, but we don't declare that and have no UTI for it to avoid conflicts with other apps; the only thing that can open it is "File->Open"._______________________________________________ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com