Skip to content

Commit

Permalink
Fix #11171. Revert "Refactor removing deprecated usages."
Browse files Browse the repository at this point in the history
This reverts commit dc827ac
  • Loading branch information
dkocher committed Sep 14, 2020
1 parent 0eba8c5 commit 3516a5f
Showing 1 changed file with 15 additions and 11 deletions.
26 changes: 15 additions & 11 deletions core/src/main/objc/LaunchServicesQuarantineService.m
Expand Up @@ -27,18 +27,22 @@ JNIEXPORT jboolean JNICALL Java_ch_cyberduck_core_local_LaunchServicesQuarantine
{
JNF_COCOA_ENTER(env);
NSURL* url = [NSURL fileURLWithPath:JNFJavaToNSString(env, path)];
NSMutableDictionary* attrs = [[NSMutableDictionary alloc] init];
// Write quarantine attributes
[attrs setValue:(NSString*)kLSQuarantineTypeOtherDownload forKey:(NSString*)kLSQuarantineTypeKey];
[attrs setValue:JNFJavaToNSString(env, originUrl) forKey:(NSString*)kLSQuarantineOriginURLKey];
[attrs setValue:JNFJavaToNSString(env, dataUrl) forKey:(NSString*)kLSQuarantineDataURLKey];
FSRef ref;
if(CFURLGetFSRef((CFURLRef) url, &ref)) {
NSMutableDictionary* attrs = [[NSMutableDictionary alloc] init];
// Write quarantine attributes
[attrs setValue:(NSString*)kLSQuarantineTypeOtherDownload forKey:(NSString*)kLSQuarantineTypeKey];
[attrs setValue:JNFJavaToNSString(env, originUrl) forKey:(NSString*)kLSQuarantineOriginURLKey];
[attrs setValue:JNFJavaToNSString(env, dataUrl) forKey:(NSString*)kLSQuarantineDataURLKey];

if(!CFURLSetResourcePropertyForKey((CFURLRef) url, kCFURLQuarantinePropertiesKey, (CFDictionaryRef*) attrs, NULL)) {
NSLog(@"Error writing quarantine attribute");
return FALSE;
}
[attrs release];
return TRUE;
if(LSSetItemAttribute(&ref, kLSRolesAll, kLSItemQuarantineProperties, (CFDictionaryRef*) attrs) != noErr) {
NSLog(@"Error writing quarantine attribute");
return FALSE;
}
[attrs release];
return TRUE;
}
return FALSE;
JNF_COCOA_EXIT(env);
}

Expand Down

0 comments on commit 3516a5f

Please sign in to comment.