diff options
author | Sven Weidauer <sven.weidauer@gmail.com> | 2011-05-19 07:27:21 +0000 |
---|---|---|
committer | Sven Weidauer <sven.weidauer@gmail.com> | 2011-05-19 07:27:21 +0000 |
commit | eb0570f39dd1d4c17632cc883579c1f8887791d3 (patch) | |
tree | a61bc2c464cc38c0d4b4a9618ef5129ae519e5f2 | |
parent | ae46764ec4ca777b9070668d20f078757066134e (diff) | |
download | netsurf-eb0570f39dd1d4c17632cc883579c1f8887791d3.tar.gz netsurf-eb0570f39dd1d4c17632cc883579c1f8887791d3.tar.bz2 |
Adding quarantine attributes to downloaded files.
svn path=/trunk/netsurf/; revision=12429
-rw-r--r-- | cocoa/DownloadWindowController.m | 12 |
1 files changed, 12 insertions, 0 deletions
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]; |