2019-01-18 14:31:14 +00:00
|
|
|
// Copyright 2019 Dolphin Emulator Project
|
2021-07-05 01:22:19 +00:00
|
|
|
// SPDX-License-Identifier: GPL-2.0-or-later
|
2019-01-18 14:31:14 +00:00
|
|
|
|
|
|
|
#import "AppDelegate.h"
|
|
|
|
|
2019-02-25 22:08:03 +00:00
|
|
|
#include "UpdaterCommon/UpdaterCommon.h"
|
2019-01-18 14:31:14 +00:00
|
|
|
|
|
|
|
#include <Cocoa/Cocoa.h>
|
2019-03-03 12:56:54 +00:00
|
|
|
#include <string>
|
2019-01-18 14:31:14 +00:00
|
|
|
#include <vector>
|
|
|
|
|
2021-03-13 01:10:53 +00:00
|
|
|
// Refer to docs/autoupdate_overview.md for a detailed overview of the autoupdate process
|
|
|
|
|
2019-01-18 14:31:14 +00:00
|
|
|
@interface AppDelegate ()
|
|
|
|
|
|
|
|
@end
|
|
|
|
|
|
|
|
@implementation AppDelegate
|
|
|
|
|
2021-03-13 01:10:53 +00:00
|
|
|
- (void)applicationDidFinishLaunching:(NSNotification*)aNotification
|
|
|
|
{
|
2019-01-18 14:31:14 +00:00
|
|
|
NSArray* arguments = [[NSProcessInfo processInfo] arguments];
|
|
|
|
|
|
|
|
__block std::vector<std::string> args;
|
|
|
|
[arguments
|
|
|
|
enumerateObjectsUsingBlock:^(NSString* _Nonnull obj, NSUInteger idx, BOOL* _Nonnull stop) {
|
|
|
|
args.push_back(std::string([obj UTF8String]));
|
|
|
|
}];
|
|
|
|
|
|
|
|
dispatch_queue_t queue = dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0ul);
|
|
|
|
dispatch_async(queue, ^{
|
2019-03-03 12:56:54 +00:00
|
|
|
RunUpdater(args);
|
|
|
|
[NSApp performSelector:@selector(terminate:) withObject:nil afterDelay:0.0];
|
2019-01-18 14:31:14 +00:00
|
|
|
});
|
|
|
|
}
|
|
|
|
|
2021-03-13 01:10:53 +00:00
|
|
|
- (void)applicationWillTerminate:(NSNotification*)aNotification
|
|
|
|
{
|
2019-01-18 14:31:14 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
@end
|