On Fri, 09 Dec 2011 13:14:26 -0700 C.W. Betts wrote > > What is the best way to handle double-clicked files in an application that > doesn't use documents? The reason I ask is because a project I'm working on, > PCSX-R, currently uses NSDocument subclasses to handle opening of files > double-clicked in the Finder. However, the readFromFileWrapper:ofType:error: > function returns NO even if the file is loaded to prevent the document window > from popping up (I have it se with no close buttons; the window is called > modally), but it shows an error that the file wasn't opened, despite it being > so. Should I use a different way of managing double-clicked files, or is > there a function that I should overload on my NSDocument subclass? > > ------------------------------ Hi, not sure if understand your question.
I am assuming 1. you want program to start from double click of document file 2. you want to be able to open program by clicking application file but do not want the app to open an empty document window. Create a document based application. Create an application delegate file // MyApplicationDelegate.h #import <Cocoa/Cocoa.h> @interface MyApplicationDelegate : NSObject <NSApplicationDelegate> { } @end // MyApplicationDelegate.m #import "MyApplicationDelegate.h" @implementation MyApplicationDelegate - (BOOL)applicationShouldOpenUntitledFile:(NSApplication *)sender { return NO; } // end applicationShouldOpenUntitledFile @end In mainMenu.xib link the application's delegate outlet to MyApplicationDelegate And that's it. See bottom of this page http://developer.apple.com/library/mac/#documentation/Cocoa/Conceptual/Documents/Tasks/FAQ.html#//apple_ref/doc/uid/20000954-BAJDAFAB also http://www.cocoadev.com/index.pl?DocumentBasedAppOpenLastFileonStartup and http://developer.apple.com/library/mac/#documentation/Cocoa/Reference/NSApplicationDelegate_Protocol/Reference/Reference.html Hope this helps. Julius http://juliuspaintings.co.uk _______________________________________________ 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