mirror of
https://github.com/atom/atom.git
synced 2026-01-23 05:48:10 -05:00
Open default path from applicationDidFinishLaunching
This is called after openFiles and so the default path will open be opened if other explicit files were not opened such as by dropping onto the dock icon
This commit is contained in:
@@ -6,6 +6,7 @@ class AtomCefClient;
|
||||
@interface AtomApplication : NSApplication <CefAppProtocol, NSApplicationDelegate> {
|
||||
NSWindowController *_backgroundWindowController;
|
||||
NSDictionary *_arguments;
|
||||
BOOL _filesOpened;
|
||||
BOOL handlingSendEvent_;
|
||||
}
|
||||
|
||||
@@ -22,4 +23,4 @@ class AtomCefClient;
|
||||
|
||||
@property (nonatomic, retain) NSDictionary *arguments;
|
||||
|
||||
@end
|
||||
@end
|
||||
|
||||
@@ -174,24 +174,31 @@
|
||||
|
||||
# pragma mark NSApplicationDelegate
|
||||
|
||||
- (BOOL)shouldOpenFiles {
|
||||
if ([self.arguments objectForKey:@"benchmark"]) {
|
||||
return NO;
|
||||
}
|
||||
if ([self.arguments objectForKey:@"test"]) {
|
||||
return NO;
|
||||
}
|
||||
return YES;
|
||||
}
|
||||
|
||||
- (void)application:(NSApplication *)sender openFiles:(NSArray *)filenames {
|
||||
for (int i = 0; i < [filenames count]; i++) {
|
||||
NSString *path = [filenames objectAtIndex:i];
|
||||
path = [[self class] standardizePathToOpen:path withArguments:self.arguments];
|
||||
[self open:path];
|
||||
if ([self shouldOpenFiles]) {
|
||||
for (int i = 0; i < [filenames count]; i++) {
|
||||
NSString *path = [filenames objectAtIndex:i];
|
||||
path = [[self class] standardizePathToOpen:path withArguments:self.arguments];
|
||||
[self open:path];
|
||||
}
|
||||
if ([filenames count] > 0) {
|
||||
_filesOpened = YES;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
- (void)applicationWillFinishLaunching:(NSNotification *)notification {
|
||||
_backgroundWindowController = [[AtomWindowController alloc] initInBackground];
|
||||
|
||||
if ([self.arguments objectForKey:@"benchmark"]) {
|
||||
[self runBenchmarksThenExit:true];
|
||||
}
|
||||
else if ([self.arguments objectForKey:@"test"]) {
|
||||
[self runSpecsThenExit:true];
|
||||
}
|
||||
else {
|
||||
- (void)applicationDidFinishLaunching:(NSNotification *)notification {
|
||||
if (!_filesOpened && [self shouldOpenFiles]) {
|
||||
NSString *path = [self.arguments objectForKey:@"path"];
|
||||
|
||||
// Just a hack to open the Atom src by default when we run from xcode
|
||||
@@ -203,6 +210,16 @@
|
||||
}
|
||||
}
|
||||
|
||||
- (void)applicationWillFinishLaunching:(NSNotification *)notification {
|
||||
_backgroundWindowController = [[AtomWindowController alloc] initInBackground];
|
||||
if ([self.arguments objectForKey:@"benchmark"]) {
|
||||
[self runBenchmarksThenExit:true];
|
||||
}
|
||||
else if ([self.arguments objectForKey:@"test"]) {
|
||||
[self runSpecsThenExit:true];
|
||||
}
|
||||
}
|
||||
|
||||
- (void)applicationWillTerminate:(NSNotification *)notification {
|
||||
for (NSWindow *window in [self windows]) {
|
||||
[window performClose:self];
|
||||
|
||||
Reference in New Issue
Block a user