| Index: base/files/file_util_mac.mm
|
| diff --git a/base/files/file_util_mac.mm b/base/files/file_util_mac.mm
|
| index e9c6c651593571ca425c1a012db8ec76722938ff..8c97aec9803fc98aac8a448a89dae5876b3f4909 100644
|
| --- a/base/files/file_util_mac.mm
|
| +++ b/base/files/file_util_mac.mm
|
| @@ -23,7 +23,13 @@ bool CopyFile(const FilePath& from_path, const FilePath& to_path) {
|
| }
|
|
|
| bool GetTempDir(base::FilePath* path) {
|
| - NSString* tmp = NSTemporaryDirectory();
|
| + // In order to facilitate hermetic runs on OS X, first check $TMPDIR
|
| + NSProcessInfo* procInfo = [NSProcessInfo processInfo];
|
| + NSString* tmp = [[procInfo environment] objectForKey: @"TMPDIR"];
|
| + if (tmp == nil) {
|
| + // Then fallback to the immutable NSTemporaryDirectory value.
|
| + tmp = NSTemporaryDirectory();
|
| + }
|
| if (tmp == nil)
|
| return false;
|
| *path = base::mac::NSStringToFilePath(tmp);
|
|
|