AppDelegate.mm 1.0 KB

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