github.com/keybase/client/go@v0.0.0-20241007131713-f10651d043c8/kbfs/simplefs/platform_darwin.go (about) 1 //go:build darwin && !ios 2 // +build darwin,!ios 3 4 package simplefs 5 6 /* 7 #cgo CFLAGS: -x objective-c -fobjc-arc 8 #cgo LDFLAGS: -framework Foundation -framework CoreServices -lobjc 9 10 #include <Foundation/Foundation.h> 11 void quarantineFile(const char* inFilename) { 12 NSError* error = NULL; 13 NSString* filename = [NSString stringWithUTF8String:inFilename]; 14 NSURL* url = [NSURL fileURLWithPath:filename]; 15 NSDictionary* opts = [[NSDictionary alloc] initWithObjectsAndKeys: 16 (id)@"Keybase", (id)kLSQuarantineAgentNameKey, 17 (id)kLSQuarantineTypeOtherDownload, (id)kLSQuarantineTypeKey, 18 nil]; 19 [url setResourceValue:opts forKey:NSURLQuarantinePropertiesKey error:&error]; 20 } 21 */ 22 import "C" 23 import ( 24 "unsafe" 25 26 "golang.org/x/net/context" 27 ) 28 29 // Quarantine is for adding the mark of the web. 30 func Quarantine(ctx context.Context, path string) error { 31 cpath := C.CString(path) 32 defer C.free(unsafe.Pointer(cpath)) 33 C.quarantineFile(cpath) 34 return nil 35 } 36 37 func limitFilenameLengthForWindowsDownloads(filename string) string { 38 return filename 39 }