@@ -34,10 +34,11 @@ #import "TarArchive.h" #import "ZIPArchive.h" #import "ZooArchive.h" #import "OFCreateDirectoryFailedException.h" +#import "OFGetItemAttributesFailedException.h" #import "OFInvalidArgumentException.h" #import "OFInvalidFormatException.h" #import "OFNotImplementedException.h" #import "OFOpenItemFailedException.h" #import "OFReadFailedException.h" @@ -473,10 +474,23 @@ archive = [self openArchiveWithIRI: IRI type: type mode: mode encoding: encoding]; + +#ifdef OF_MACOS + @try { + OFString *attributeName = @"com.apple.quarantine"; + + _quarantine = [[[OFFileManager defaultManager] + extendedAttributeDataForName: attributeName + ofItemAtIRI: IRI] retain]; + } @catch (OFGetItemAttributesFailedException *e) { + if (e.errNo != /*ENOATTR*/ 93) + @throw e; + } +#endif if (outputDir != nil) { OFFileManager *fileManager = [OFFileManager defaultManager]; @@ -814,6 +828,17 @@ objc_autoreleasePoolPop(pool); return [path autorelease]; } + +- (void)quarantineFile: (OFString *)path +{ +#ifdef OF_MACOS + if (_quarantine != nil) + [[OFFileManager defaultManager] + setExtendedAttributeData: _quarantine + forName: @"com.apple.quarantine" + ofItemAtPath: path]; +#endif +} @end