Chromium Code Reviews| Index: base/mac_util.mm |
| =================================================================== |
| --- base/mac_util.mm (revision 31614) |
| +++ base/mac_util.mm (working copy) |
| @@ -237,4 +237,22 @@ |
| return FilePath(); |
| } |
| +bool SetFileBackupExclusion(const FilePath& file_path, bool exclude) { |
| + NSString* filePath = |
|
TVL
2009/11/11 02:51:02
CHECK/DCHECK for file_path.IsAbsolute()?
|
| + [NSString stringWithUTF8String:file_path.value().c_str()]; |
| + NSURL* url = [NSURL fileURLWithPath:filePath]; |
| + // Note that we always set CSBackupSetItemExcluded's excludeByPath param |
| + // to true. This prevents a problem with toggling the setting: if the file |
| + // is excluded with excludeByPath set to true then excludeByPath must |
| + // also be true when un-excluding the file, otherwise the un-excluding |
| + // will be ignored. |
| + bool success = |
| + CSBackupSetItemExcluded((CFURLRef)url, exclude, true) == noErr; |
|
TVL
2009/11/11 02:51:02
drive by: don't the docs talk about needing to run
|
| + if (!success) |
| + LOG(WARNING) << "Failed to set backup excluson for file '" |
| + << file_path.value().c_str() << "'. Continuing."; |
| + return success; |
| +} |
| + |
| + |
| } // namespace mac_util |