From eb0570f39dd1d4c17632cc883579c1f8887791d3 Mon Sep 17 00:00:00 2001 From: Sven Weidauer Date: Thu, 19 May 2011 07:27:21 +0000 Subject: Adding quarantine attributes to downloaded files. svn path=/trunk/netsurf/; revision=12429 --- cocoa/DownloadWindowController.m | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'cocoa') diff --git a/cocoa/DownloadWindowController.m b/cocoa/DownloadWindowController.m index ccf49aa88..82be52e51 100644 --- a/cocoa/DownloadWindowController.m +++ b/cocoa/DownloadWindowController.m @@ -21,6 +21,7 @@ #import "desktop/download.h" #import "desktop/gui.h" +#import "utils/log.h" @interface DownloadWindowController () @@ -103,6 +104,17 @@ static void cocoa_register_download( DownloadWindowController *download ); NSString *path = [targetURL path]; [[NSFileManager defaultManager] createFileAtPath: path contents: nil attributes: nil]; + + FSRef ref; + if (CFURLGetFSRef( (CFURLRef)targetURL, &ref )) { + NSDictionary *attributes = [NSDictionary dictionaryWithObjectsAndKeys: + url, (NSString *)kLSQuarantineDataURLKey, + (NSString *)kLSQuarantineTypeWebDownload, (NSString *)kLSQuarantineTypeKey, + nil]; + LSSetItemAttribute( &ref, kLSRolesAll, kLSItemQuarantineProperties, (CFDictionaryRef)attributes ); + LOG(("Set quarantine attributes on file %s", [path UTF8String])); + } + [self setOutputFile: [NSFileHandle fileHandleForWritingAtPath: path]]; [self setSaveURL: targetURL]; -- cgit v1.2.3