Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(2341)

Unified Diff: base/mac_util.mm

Issue 387016: For the immediate milestone, exclude History and Thumbnails from being backed... (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: '' Created 11 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « base/mac_util.h ('k') | base/mac_util_unittest.mm » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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
« no previous file with comments | « base/mac_util.h ('k') | base/mac_util_unittest.mm » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698