replaced deprecated APIs
This commit is contained in:
parent
5017969ff7
commit
4bb405a5e4
|
@ -852,8 +852,9 @@ bail:
|
|||
goto bail;
|
||||
}
|
||||
|
||||
//ignore leak warning
|
||||
//ignore warning
|
||||
#pragma clang diagnostic push
|
||||
#pragma clang diagnostic ignored "-Wpointer-to-int-cast"
|
||||
#pragma clang diagnostic ignored "-Warc-performSelector-leaks"
|
||||
|
||||
//grab connection ID
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<document type="com.apple.InterfaceBuilder3.Cocoa.XIB" version="3.0" toolsVersion="18122" targetRuntime="MacOSX.Cocoa" propertyAccessControl="none" useAutolayout="YES">
|
||||
<document type="com.apple.InterfaceBuilder3.Cocoa.XIB" version="3.0" toolsVersion="21225" targetRuntime="MacOSX.Cocoa" propertyAccessControl="none" useAutolayout="YES">
|
||||
<dependencies>
|
||||
<deployment identifier="macosx"/>
|
||||
<plugIn identifier="com.apple.InterfaceBuilder.CocoaPlugin" version="18122"/>
|
||||
<plugIn identifier="com.apple.InterfaceBuilder.CocoaPlugin" version="21225"/>
|
||||
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
|
||||
</dependencies>
|
||||
<objects>
|
||||
|
@ -16,7 +16,7 @@
|
|||
<customObject id="-1" userLabel="First Responder" customClass="FirstResponder"/>
|
||||
<customObject id="-3" userLabel="Application" customClass="NSObject"/>
|
||||
<window allowsToolTipsWhenApplicationIsInactive="NO" autorecalculatesKeyViewLoop="NO" releasedWhenClosed="NO" animationBehavior="default" id="F0z-JX-Cv5">
|
||||
<windowStyleMask key="styleMask" titled="YES" closable="YES" texturedBackground="YES"/>
|
||||
<windowStyleMask key="styleMask" titled="YES" closable="YES"/>
|
||||
<rect key="contentRect" x="196" y="240" width="486" height="301"/>
|
||||
<rect key="screenRect" x="0.0" y="0.0" width="3440" height="1415"/>
|
||||
<view key="contentView" id="se5-gp-TjO">
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<document type="com.apple.InterfaceBuilder3.Cocoa.XIB" version="3.0" toolsVersion="18122" targetRuntime="MacOSX.Cocoa" propertyAccessControl="none" useAutolayout="YES">
|
||||
<document type="com.apple.InterfaceBuilder3.Cocoa.XIB" version="3.0" toolsVersion="21225" targetRuntime="MacOSX.Cocoa" propertyAccessControl="none" useAutolayout="YES">
|
||||
<dependencies>
|
||||
<deployment identifier="macosx"/>
|
||||
<plugIn identifier="com.apple.InterfaceBuilder.CocoaPlugin" version="18122"/>
|
||||
<plugIn identifier="com.apple.InterfaceBuilder.CocoaPlugin" version="21225"/>
|
||||
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
|
||||
</dependencies>
|
||||
<objects>
|
||||
|
@ -18,7 +18,7 @@
|
|||
<customObject id="-1" userLabel="First Responder" customClass="FirstResponder"/>
|
||||
<customObject id="-3" userLabel="Application" customClass="NSObject"/>
|
||||
<window allowsToolTipsWhenApplicationIsInactive="NO" autorecalculatesKeyViewLoop="NO" releasedWhenClosed="NO" animationBehavior="default" id="F0z-JX-Cv5">
|
||||
<windowStyleMask key="styleMask" titled="YES" closable="YES" texturedBackground="YES"/>
|
||||
<windowStyleMask key="styleMask" titled="YES" closable="YES"/>
|
||||
<rect key="contentRect" x="196" y="240" width="422" height="133"/>
|
||||
<rect key="screenRect" x="0.0" y="0.0" width="3440" height="1415"/>
|
||||
<view key="contentView" id="se5-gp-TjO">
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<document type="com.apple.InterfaceBuilder3.Cocoa.XIB" version="3.0" toolsVersion="18122" targetRuntime="MacOSX.Cocoa" propertyAccessControl="none" useAutolayout="YES">
|
||||
<document type="com.apple.InterfaceBuilder3.Cocoa.XIB" version="3.0" toolsVersion="21225" targetRuntime="MacOSX.Cocoa" propertyAccessControl="none" useAutolayout="YES">
|
||||
<dependencies>
|
||||
<deployment identifier="macosx"/>
|
||||
<plugIn identifier="com.apple.InterfaceBuilder.CocoaPlugin" version="18122"/>
|
||||
<plugIn identifier="com.apple.InterfaceBuilder.CocoaPlugin" version="21225"/>
|
||||
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
|
||||
</dependencies>
|
||||
<objects>
|
||||
|
@ -17,7 +17,7 @@
|
|||
<customObject id="-1" userLabel="First Responder" customClass="FirstResponder"/>
|
||||
<customObject id="-3" userLabel="Application" customClass="NSObject"/>
|
||||
<window allowsToolTipsWhenApplicationIsInactive="NO" autorecalculatesKeyViewLoop="NO" releasedWhenClosed="NO" animationBehavior="default" id="F0z-JX-Cv5">
|
||||
<windowStyleMask key="styleMask" titled="YES" closable="YES" texturedBackground="YES"/>
|
||||
<windowStyleMask key="styleMask" titled="YES" closable="YES"/>
|
||||
<rect key="contentRect" x="196" y="240" width="486" height="301"/>
|
||||
<rect key="screenRect" x="0.0" y="0.0" width="3440" height="1415"/>
|
||||
<view key="contentView" id="se5-gp-TjO">
|
||||
|
|
|
@ -162,8 +162,8 @@ extern os_log_t logHandle;
|
|||
//app path
|
||||
NSURL* appPath = nil;
|
||||
|
||||
//error
|
||||
NSError* error = nil;
|
||||
//app config
|
||||
NSWorkspaceOpenConfiguration* configuration = nil;
|
||||
|
||||
//grab tag
|
||||
action = ((NSButton*)sender).tag;
|
||||
|
@ -235,20 +235,46 @@ extern os_log_t logHandle;
|
|||
//init app path
|
||||
appPath = [NSURL fileURLWithPath:[@"/Applications" stringByAppendingPathComponent:APP_NAME]];
|
||||
|
||||
//alloc configuration
|
||||
configuration = [[NSWorkspaceOpenConfiguration alloc] init];
|
||||
|
||||
//set args
|
||||
configuration.arguments = @[INITIAL_LAUNCH];
|
||||
|
||||
//unset recent
|
||||
configuration.addsToRecentItems = NO;
|
||||
|
||||
//dbg msg
|
||||
os_log_debug(logHandle, "now launching: %{public}@", appPath);
|
||||
os_log_debug(logHandle, "now launching: %{public}@", appPath.path);
|
||||
|
||||
//launch it
|
||||
if(nil == [[NSWorkspace sharedWorkspace] launchApplicationAtURL:appPath options:0 configuration:@{NSWorkspaceLaunchConfigurationArguments:@[INITIAL_LAUNCH]} error:&error])
|
||||
[NSWorkspace.sharedWorkspace openApplicationAtURL:appPath configuration:configuration completionHandler:^(NSRunningApplication * _Nullable application, NSError * _Nullable error)
|
||||
{
|
||||
#pragma unused(application)
|
||||
|
||||
//error?
|
||||
if(nil != error)
|
||||
{
|
||||
//err msg
|
||||
os_log_error(logHandle, "ERROR: failed to launch %{public}@ (error: %{public}@)", appPath, error);
|
||||
}
|
||||
}
|
||||
|
||||
//close window
|
||||
// triggers cleanup logic
|
||||
dispatch_sync(dispatch_get_main_queue(),
|
||||
^{
|
||||
[self.window close];
|
||||
});
|
||||
|
||||
}];
|
||||
}
|
||||
|
||||
else
|
||||
{
|
||||
//close window
|
||||
// triggers cleanup logic
|
||||
[self.window close];
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
|
@ -300,7 +326,7 @@ extern os_log_t logHandle;
|
|||
|
||||
//open URL
|
||||
// invokes user's default browser
|
||||
[[NSWorkspace sharedWorkspace] openURL:[NSURL URLWithString:ERRORS_URL]];
|
||||
[NSWorkspace.sharedWorkspace openURL:[NSURL URLWithString:ERRORS_URL]];
|
||||
|
||||
return;
|
||||
}
|
||||
|
@ -561,6 +587,10 @@ bail:
|
|||
//exit on main thread
|
||||
dispatch_async(dispatch_get_main_queue(),
|
||||
^{
|
||||
|
||||
//dbg msg
|
||||
os_log_debug(logHandle, "%{public}@ exiting...", [NSProcessInfo.processInfo.arguments.firstObject lastPathComponent]);
|
||||
|
||||
//exit
|
||||
[NSApp terminate:self];
|
||||
});
|
||||
|
|
|
@ -21,7 +21,7 @@
|
|||
<customObject id="-1" userLabel="First Responder" customClass="FirstResponder"/>
|
||||
<customObject id="-3" userLabel="Application" customClass="NSObject"/>
|
||||
<window allowsToolTipsWhenApplicationIsInactive="NO" autorecalculatesKeyViewLoop="NO" releasedWhenClosed="NO" visibleAtLaunch="NO" animationBehavior="default" id="F0z-JX-Cv5">
|
||||
<windowStyleMask key="styleMask" titled="YES" closable="YES" texturedBackground="YES"/>
|
||||
<windowStyleMask key="styleMask" titled="YES" closable="YES"/>
|
||||
<rect key="contentRect" x="196" y="240" width="523" height="237"/>
|
||||
<rect key="screenRect" x="0.0" y="0.0" width="3440" height="1415"/>
|
||||
<view key="contentView" id="se5-gp-TjO">
|
||||
|
|
|
@ -24,6 +24,7 @@
|
|||
#import <Foundation/Foundation.h>
|
||||
#import <CommonCrypto/CommonDigest.h>
|
||||
#import <SystemConfiguration/SystemConfiguration.h>
|
||||
#import <UniformTypeIdentifiers/UniformTypeIdentifiers.h>
|
||||
|
||||
/* GLOBALS */
|
||||
|
||||
|
@ -888,7 +889,7 @@ NSImage* getIconForProcess(NSString* path)
|
|||
if(YES != [NSFileManager.defaultManager fileExistsAtPath:path])
|
||||
{
|
||||
//set icon to system 'application' icon
|
||||
icon = [NSWorkspace.sharedWorkspace iconForFileType: NSFileTypeForHFSTypeCode(kGenericApplicationIcon)];
|
||||
icon = [NSWorkspace.sharedWorkspace iconForContentType:[UTType typeWithFilenameExtension:@"app"]];
|
||||
|
||||
//set size to 64 @2x
|
||||
[icon setSize:NSMakeSize(128, 128)];
|
||||
|
@ -946,8 +947,8 @@ NSImage* getIconForProcess(NSString* path)
|
|||
if(nil == documentIcon)
|
||||
{
|
||||
//load
|
||||
documentIcon = [[NSWorkspace sharedWorkspace] iconForFileType:
|
||||
NSFileTypeForHFSTypeCode(kGenericDocumentIcon)];
|
||||
documentIcon = [NSWorkspace.sharedWorkspace iconForContentType:[UTType typeWithFilenameExtension:@"txt"]];
|
||||
|
||||
}
|
||||
|
||||
//if 'iconForFile' method doesn't find and icon, it returns the system 'document' icon
|
||||
|
@ -955,8 +956,7 @@ NSImage* getIconForProcess(NSString* path)
|
|||
if(YES == [icon isEqual:documentIcon])
|
||||
{
|
||||
//set icon to system 'application' icon
|
||||
icon = [[NSWorkspace sharedWorkspace]
|
||||
iconForFileType: NSFileTypeForHFSTypeCode(kGenericApplicationIcon)];
|
||||
icon = [NSWorkspace.sharedWorkspace iconForContentType:[UTType typeWithFilenameExtension:@"app"]];
|
||||
}
|
||||
|
||||
//'iconForFileType' returns small icons
|
||||
|
|
|
@ -2,4 +2,4 @@ Patrons (2^6+):
|
|||
Jan Koum, Nick, Shain Singh, Christian Blümlein, Rocky Zadok, Cane Juice, M S
|
||||
|
||||
Friends of Objective-See:
|
||||
Kandji, Jamf, Mosyle, CleanMyMac X, Kolide, Fleet, Palo Alto Networks, SmugMug, Guardian Mobile Firewall, iVerify, Halo Privacy
|
||||
Kandji, Jamf, Mosyle, CleanMyMac X, Kolide, Fleet, Palo Alto Networks, Sophos, SmugMug, Guardian Mobile Firewall, iVerify, Halo Privacy
|
||||
|
|
Loading…
Reference in New Issue