github.com/keybase/client/go@v0.0.0-20240309051027-028f7c731f8b/libkb/disable_backup_darwin.go (about) 1 //go:build darwin 2 // +build darwin 3 4 package libkb 5 6 import ( 7 "path/filepath" 8 9 "github.com/pkg/xattr" 10 ) 11 12 const noBackup = "com.apple.metadata:com_apple_backup_excludeItem com.apple.backupd" 13 14 func SetDisableBackup(mctx MetaContext, name string) error { 15 path := filepath.Dir(name) 16 filename := filepath.Base(name) 17 // CrashPlan respects this metadata flag as does TimeMachine. 18 // https://support.crashplan.com/Troubleshooting/CrashPlan_And_OS_X_Metadata 19 err := xattr.Set(path, filename, []byte(noBackup)) 20 if err != nil { 21 mctx.Debug("Unable to write xattr %s", filepath.Join(path, filename)) 22 } 23 return err 24 }