diff options
author | mrossetti@chromium.org <mrossetti@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-11-11 02:49:05 +0000 |
---|---|---|
committer | mrossetti@chromium.org <mrossetti@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-11-11 02:49:05 +0000 |
commit | b4113d5feb3b47f5f9aaa4e7aeeacc0d95d81f36 (patch) | |
tree | e455862522cfe5a297c70edbce743e021a5769af /base/mac_util.mm | |
parent | 1c966c891f7f495fd08c84b58ec145bd6bd7d181 (diff) | |
download | chromium_src-b4113d5feb3b47f5f9aaa4e7aeeacc0d95d81f36.zip chromium_src-b4113d5feb3b47f5f9aaa4e7aeeacc0d95d81f36.tar.gz chromium_src-b4113d5feb3b47f5f9aaa4e7aeeacc0d95d81f36.tar.bz2 |
For the immediate milestone, exclude History and Thumbnails from being backed up by Time Machine. The bug describes appropriate long-term solutions to this problem.
BUG=259595
TEST=Launch Chrome. Inspect the following files found in ~/Library/Application Support/Chromium/Default/: a) History, b) History-journal, c) Thumbnails, and d) Thumbnails-journal and verify that they are not being backed up by Time Machine.
Review URL: http://codereview.chromium.org/387016
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@31644 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'base/mac_util.mm')
-rw-r--r-- | base/mac_util.mm | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/base/mac_util.mm b/base/mac_util.mm index 0eee0e2..1418453 100644 --- a/base/mac_util.mm +++ b/base/mac_util.mm @@ -237,4 +237,22 @@ FilePath GetAppBundlePath(const FilePath& exec_name) { return FilePath(); } +bool SetFileBackupExclusion(const FilePath& file_path, bool exclude) { + NSString* filePath = + [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; + if (!success) + LOG(WARNING) << "Failed to set backup excluson for file '" + << file_path.value().c_str() << "'. Continuing."; + return success; +} + + } // namespace mac_util |