From e174edd0dcb79ba64d37fa999fea6a41b7c8e988 Mon Sep 17 00:00:00 2001 From: Francisco Ryan Tolmasky I Date: Wed, 19 Aug 2009 20:41:27 -0700 Subject: [PATCH] Added file opening conviniences. Reviewed by me. --- AppKit/CPApplication.j | 20 ++++++++++++++++++-- 1 file changed, 18 insertions(+), 2 deletions(-) diff --git a/AppKit/CPApplication.j b/AppKit/CPApplication.j index 423baacbf..0593c6f0d 100644 --- a/AppKit/CPApplication.j +++ b/AppKit/CPApplication.j @@ -86,6 +86,7 @@ CPRunContinuesResponse = -1002; // id _delegate; + BOOL _finishedLaunching; CPDictionary _namedArgs; CPArray _args; @@ -269,7 +270,15 @@ CPRunContinuesResponse = -1002; postNotificationName:CPApplicationWillFinishLaunchingNotification object:self]; - var needsUntitled = !!_documentController; + var filename = window.cpOpeningFilename(), + needsUntitled = !!_documentController; + + if ([filename length]) + { + [self _openFile:filename]; + + needsUntitled = NO; + } if (needsUntitled && [_delegate respondsToSelector: @selector(applicationShouldOpenUntitledFile:)]) needsUntitled = [_delegate applicationShouldOpenUntitledFile:self]; @@ -280,8 +289,10 @@ CPRunContinuesResponse = -1002; [defaultCenter postNotificationName:CPApplicationDidFinishLaunchingNotification object:self]; - + [[CPRunLoop currentRunLoop] limitDateForMode:CPDefaultRunLoopMode]; + + _finishedLaunching = YES; } /*! @@ -745,6 +756,11 @@ CPRunContinuesResponse = -1002; return _namedArgs; } +- (void)_openFile:(CPString)aFilename +{ + [_documentController openDocumentWithContentsOfURL:aFilename display:YES error:NULL]; +} + @end var _CPModalSessionMake = function(aWindow, aStopCode)