From 0557a5ba5c11f1c8e1f1f4c4407a41549ce25cf7 Mon Sep 17 00:00:00 2001 From: Zorg Date: Fri, 8 May 2015 23:55:23 -0400 Subject: [PATCH] Only remove quarantine with setResourceValue: when it's present This should stop "Unable to quarantine: 93" messages from showing up in the console. Fixes issue #452 --- Sparkle/SUPlainInstallerInternals.m | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/Sparkle/SUPlainInstallerInternals.m b/Sparkle/SUPlainInstallerInternals.m index e06e5bdf..41b297e8 100644 --- a/Sparkle/SUPlainInstallerInternals.m +++ b/Sparkle/SUPlainInstallerInternals.m @@ -599,7 +599,11 @@ static BOOL AuthorizationExecuteWithPrivilegesAndWait(AuthorizationRef authoriza } #endif NSURL *rootURL = [NSURL fileURLWithPath:root]; - [rootURL setResourceValue:[NSNull null] forKey:NSURLQuarantinePropertiesKey error:NULL]; + id rootResourceValue = nil; + [rootURL getResourceValue:&rootResourceValue forKey:NSURLQuarantinePropertiesKey error:NULL]; + if (rootResourceValue) { + [rootURL setResourceValue:[NSNull null] forKey:NSURLQuarantinePropertiesKey error:NULL]; + } // Only recurse if it's actually a directory. Don't recurse into a // root-level symbolic link. @@ -612,7 +616,11 @@ static BOOL AuthorizationExecuteWithPrivilegesAndWait(AuthorizationRef authoriza NSDirectoryEnumerator *directoryEnumerator = [manager enumeratorAtURL:rootURL includingPropertiesForKeys:nil options:(NSDirectoryEnumerationOptions)0 errorHandler:nil]; for (NSURL *file in directoryEnumerator) { - [file setResourceValue:[NSNull null] forKey:NSURLQuarantinePropertiesKey error:NULL]; + id fileResourceValue = nil; + [file getResourceValue:&fileResourceValue forKey:NSURLQuarantinePropertiesKey error:NULL]; + if (fileResourceValue) { + [file setResourceValue:[NSNull null] forKey:NSURLQuarantinePropertiesKey error:NULL]; + } } } }