| 1 |
// Copyright 2019 Dolphin Emulator Project |
| 2 |
// SPDX-License-Identifier: GPL-2.0-or-later |
| 3 |
|
| 4 |
#import "AppDelegate.h" |
| 5 |
|
| 6 |
#include "UpdaterCommon/UpdaterCommon.h" |
| 7 |
|
| 8 |
#include <Cocoa/Cocoa.h> |
| 9 |
#include <string> |
| 10 |
#include <vector> |
| 11 |
|
| 12 |
// Refer to docs/autoupdate_overview.md for a detailed overview of the autoupdate process |
| 13 |
|
| 14 |
@interface AppDelegate () |
| 15 |
|
| 16 |
@end |
| 17 |
|
| 18 |
@implementation AppDelegate |
| 19 |
|
| 20 |
- (void)applicationDidFinishLaunching:(NSNotification*)aNotification |
| 21 |
{ |
| 22 |
NSArray* arguments = [[NSProcessInfo processInfo] arguments]; |
| 23 |
|
| 24 |
__block std::vector<std::string> args; |
| 25 |
[arguments |
| 26 |
enumerateObjectsUsingBlock:^(NSString* _Nonnull obj, NSUInteger idx, BOOL* _Nonnull stop) { |
| 27 |
args.push_back(std::string([obj UTF8String])); |
| 28 |
}]; |
| 29 |
|
| 30 |
dispatch_queue_t queue = dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0ul); |
| 31 |
dispatch_async(queue, ^{ |
| 32 |
RunUpdater(args); |
| 33 |
[NSApp performSelector:@selector(terminate:) withObject:nil afterDelay:0.0]; |
| 34 |
}); |
| 35 |
} |
| 36 |
|
| 37 |
- (void)applicationWillTerminate:(NSNotification*)aNotification |
| 38 |
{ |
| 39 |
} |
| 40 |
|
| 41 |
@end |