Better, forward-compatible way of looking up NSURLQuarantinePropertiesKey, as suggested by @jakepetroules

This commit is contained in:
C.W. Betts committed 2014-07-19 14:38:51 -06:00
1 parent 5a3fd1e12a
commit 591d7d0049
3 files changed
+6 -4

No files matched your search

+1
View File
@@ -9,3 +9,4 @@ FRAMEWORK_VERSION = A
INFOPLIST_FILE = Sparkle/Sparkle-Info.plist
GCC_PREFIX_HEADER = Sparkle/Sparkle.pch
SKIP_INSTALL = YES
OTHER_LDFLAGS = -Wl,-U,_NSURLQuarantinePropertiesKey
+1
View File
@@ -5,3 +5,4 @@ PRODUCT_NAME = $(FINISH_INSTALL_TOOL_NAME)
SKIP_INSTALL = YES
GCC_PREFIX_HEADER = Sparkle/Autoupdate/Autoupdate.pch
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon
OTHER_LDFLAGS = -Wl,-U,_NSURLQuarantinePropertiesKey
+4 -4
View File
@@ -23,6 +23,10 @@
#include <unistd.h>
#include <sys/param.h>
#if __MAC_OS_X_VERSION_MAX_ALLOWED < 10100
extern NSString *const NSURLQuarantinePropertiesKey WEAK_IMPORT_ATTRIBUTE;
#endif
static inline void PerformOnMainThreadSync(dispatch_block_t theBlock)
{
if ([NSThread isMainThread]) {
@@ -565,7 +569,6 @@ static BOOL AuthorizationExecuteWithPrivilegesAndWait(AuthorizationRef authoriza
// *** MUST BE SAFE TO CALL ON NON-MAIN THREAD!
NSFileManager *manager = [NSFileManager defaultManager];
#if __MAC_OS_X_VERSION_MAX_ALLOWED > __MAC_10_9
if (&NSURLQuarantinePropertiesKey) {
NSURL *rootURL = [NSURL fileURLWithPath:root];
[rootURL setResourceValue:[NSNull null] forKey:NSURLQuarantinePropertiesKey error:NULL];
@@ -585,7 +588,6 @@ static BOOL AuthorizationExecuteWithPrivilegesAndWait(AuthorizationRef authoriza
}
}
} else {
#endif
NSString *const quarantineAttribute = (NSString*)kLSItemQuarantineProperties;
const int removeXAttrOptions = XATTR_NOFOLLOW;
@@ -609,9 +611,7 @@ static BOOL AuthorizationExecuteWithPrivilegesAndWait(AuthorizationRef authoriza
options:removeXAttrOptions];
}
}
#if __MAC_OS_X_VERSION_MAX_ALLOWED > __MAC_10_9
}
#endif
}
@end