|
@@ -4,12 +4,6 @@
|
|
|
|
|
|
#import <Cocoa/Cocoa.h>
|
|
|
|
|
|
-// launchApplication is deprecated; should be migrated to
|
|
|
-// [NSWorkspace openApplicationAtURL:configuration:completionHandler:]
|
|
|
-// UserNotifications.frameworks API
|
|
|
-#pragma clang diagnostic push
|
|
|
-#pragma clang diagnostic ignored "-Wdeprecated-declarations"
|
|
|
-
|
|
|
int main(int argc, char* argv[]) {
|
|
|
@autoreleasepool {
|
|
|
NSArray* pathComponents =
|
|
@@ -17,11 +11,18 @@ int main(int argc, char* argv[]) {
|
|
|
pathComponents = [pathComponents
|
|
|
subarrayWithRange:NSMakeRange(0, [pathComponents count] - 4)];
|
|
|
NSString* path = [NSString pathWithComponents:pathComponents];
|
|
|
+ NSURL* url = [NSURL fileURLWithPath:path];
|
|
|
|
|
|
- [[NSWorkspace sharedWorkspace] launchApplication:path];
|
|
|
+ [[NSWorkspace sharedWorkspace]
|
|
|
+ openApplicationAtURL:url
|
|
|
+ configuration:NSWorkspaceOpenConfiguration.configuration
|
|
|
+ completionHandler:^(NSRunningApplication* app, NSError* error) {
|
|
|
+ if (error) {
|
|
|
+ NSLog(@"Failed to launch application: %@", error);
|
|
|
+ } else {
|
|
|
+ NSLog(@"Application launched successfully: %@", app);
|
|
|
+ }
|
|
|
+ }];
|
|
|
return 0;
|
|
|
}
|
|
|
}
|
|
|
-
|
|
|
-// -Wdeprecated-declarations
|
|
|
-#pragma clang diagnostic pop
|