diff options
author | mrossetti@chromium.org <mrossetti@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-06-15 18:36:18 +0000 |
---|---|---|
committer | mrossetti@chromium.org <mrossetti@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-06-15 18:36:18 +0000 |
commit | 34af8e7bd57b09064a5ffab971f74ec741afdba0 (patch) | |
tree | d5f182bf3395974bd928d0b6e0a327d0c0dd536f /base | |
parent | 2a3ddb7a94172276db4d6e5601ff66e3eb6e5f6a (diff) | |
download | chromium_src-34af8e7bd57b09064a5ffab971f74ec741afdba0.zip chromium_src-34af8e7bd57b09064a5ffab971f74ec741afdba0.tar.gz chromium_src-34af8e7bd57b09064a5ffab971f74ec741afdba0.tar.bz2 |
Remove Leftover -journal File By-path Exclusions
Added code to clear old History and Thumbnail -journal file by-path backup exclusions.
BUG=None
TEST=None
Review URL: http://codereview.chromium.org/7148024
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@89225 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'base')
-rw-r--r-- | base/mac/mac_util.h | 6 | ||||
-rw-r--r-- | base/mac/mac_util.mm | 33 |
2 files changed, 27 insertions, 12 deletions
diff --git a/base/mac/mac_util.h b/base/mac/mac_util.h index eed516e..990a543 100644 --- a/base/mac/mac_util.h +++ b/base/mac/mac_util.h @@ -81,6 +81,12 @@ void ActivateProcess(pid_t pid); // Excludes the file given by |file_path| from being backed up by Time Machine. bool SetFileBackupExclusion(const FilePath& file_path); +// TODO(mrossetti): Remove in M15. See http://crbug.com/85999 +// Remove possible exclude-by-path setting from |file_path|. Ignore errors since +// we don't care if the file does not exist or if it has not had its exclusion +// set by-path. This function is a NOOP for Mac OS X Lion or later. +void ClearByPathBackupExclusion(const FilePath& file_path); + // Sets the process name as displayed in Activity Monitor to process_name. void SetProcessName(CFStringRef process_name); diff --git a/base/mac/mac_util.mm b/base/mac/mac_util.mm index eebf133..0b6bca7 100644 --- a/base/mac/mac_util.mm +++ b/base/mac/mac_util.mm @@ -242,23 +242,32 @@ void ActivateProcess(pid_t pid) { } } +// TODO(mrossetti): Remove in M15. See http://crbug.com/85999 +void ClearByPathBackupExclusion(const FilePath& file_path) { + if (IsOSSnowLeopardOrEarlier()) { + NSString* file_path_ns = + [NSString stringWithUTF8String:file_path.value().c_str()]; + NSURL* file_url = [NSURL fileURLWithPath:file_path_ns]; + // Ignore errors since the file may not exist. + CSBackupSetItemExcluded(base::mac::NSToCFCast(file_url), FALSE, TRUE); + } +} + bool SetFileBackupExclusion(const FilePath& file_path) { + // Do a pre-emptive unexclude by-path since by-path exclusions may have + // been performed on this file in the past. This feature is available to + // administrative users in 10.5 and 10.6, but is restricted to the root + // user in 10.7. Since it logs messages to the console in 10.7 and + // wouldn't work anyway, avoid calling it altogether in that version. + // + // TODO(mrossetti): Remove on the trunk after September + // 2011, M15. http://crbug.com/85999 + ClearByPathBackupExclusion(file_path); + NSString* file_path_ns = [NSString stringWithUTF8String:file_path.value().c_str()]; NSURL* file_url = [NSURL fileURLWithPath:file_path_ns]; - if (IsOSSnowLeopardOrEarlier()) { - // Do a pre-emptive unexclude by-path since by-path exclusions may have - // been performed on this file in the past. This feature is available to - // administrative users in 10.5 and 10.6, but is restricted to the root - // user in 10.7. Since it logs messages to the console in 10.7 and - // wouldn't work anyway, avoid calling it altogether in that version. - // - // TODO(mrossetti) or TODO(mark): remove on the trunk after September - // 2011, M15. http://crbug.com/86104 - CSBackupSetItemExcluded(base::mac::NSToCFCast(file_url), FALSE, TRUE); - } - // When excludeByPath is true the application must be running with root // privileges (admin for 10.6 and earlier) but the URL does not have to // already exist. When excludeByPath is false the URL must already exist but |