summaryrefslogtreecommitdiffstats
path: root/base/mac_util.mm
diff options
context:
space:
mode:
authorthomasvl@chromium.org <thomasvl@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-12-30 22:13:20 +0000
committerthomasvl@chromium.org <thomasvl@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-12-30 22:13:20 +0000
commitedd96f5ca7e1ae7eb8d461dd1d4f3d4e0baabbb7 (patch)
treed2781c83f13f66e7c42b624c963bf15cd6f7d77a /base/mac_util.mm
parentdb32da4ac12022c57376b9834859884bab152466 (diff)
downloadchromium_src-edd96f5ca7e1ae7eb8d461dd1d4f3d4e0baabbb7.zip
chromium_src-edd96f5ca7e1ae7eb8d461dd1d4f3d4e0baabbb7.tar.gz
chromium_src-edd96f5ca7e1ae7eb8d461dd1d4f3d4e0baabbb7.tar.bz2
Add NSTemporaryDirectory() to the list of ignored to catch all possible values. Also handle all the forms of the paths with links resolved.
TEST=page cycles, browser_tests all get back to being fast. normal profiles still exclude the files listed in the first bug. BUG=25959,30002 Review URL: http://codereview.chromium.org/523026 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@35394 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'base/mac_util.mm')
-rw-r--r--base/mac_util.mm25
1 files changed, 19 insertions, 6 deletions
diff --git a/base/mac_util.mm b/base/mac_util.mm
index f6d5dff..b1f08a8 100644
--- a/base/mac_util.mm
+++ b/base/mac_util.mm
@@ -241,12 +241,25 @@ bool SetFileBackupExclusion(const FilePath& file_path, bool exclude) {
NSString* filePath =
[NSString stringWithUTF8String:file_path.value().c_str()];
- // If being asked to exclude something in a temp directory, just lie and say
- // it was done. TimeMachine will already ignore temp directories. This keeps
- // the temporary profiles used by unittests from being added to the exclude
- // list. Otherwise, as the list grows the bots slow down due to
- // reading/writes all the temporary profiles used over time.
- if ([filePath hasPrefix:@"/tmp/"] ||
+ // If being asked to exclude something in a tmp directory, just lie and say it
+ // was done. TimeMachine will already ignore tmp directories. This keeps the
+ // temporary profiles used by unittests from being added to the exclude list.
+ // Otherwise, as /Library/Preferences/com.apple.TimeMachine.plist grows the
+ // bots slow down due to reading/writing all the temporary profiles used over
+ // time.
+
+ NSString* tmpDir = NSTemporaryDirectory();
+ // Make sure the temp dir is terminated with a slash
+ if (tmpDir && ![tmpDir hasSuffix:@"/"])
+ tmpDir = [tmpDir stringByAppendingString:@"/"];
+ // '/var' is a link to '/private/var', make sure to check both forms.
+ NSString* privateTmpDir = nil;
+ if ([tmpDir hasPrefix:@"/var/"])
+ privateTmpDir = [@"/private" stringByAppendingString:tmpDir];
+
+ if ((tmpDir && [filePath hasPrefix:tmpDir]) ||
+ (privateTmpDir && [filePath hasPrefix:privateTmpDir]) ||
+ [filePath hasPrefix:@"/tmp/"] ||
[filePath hasPrefix:@"/var/tmp/"] ||
[filePath hasPrefix:@"/private/tmp/"] ||
[filePath hasPrefix:@"/private/var/tmp/"]) {