Chromium Code Reviews| Index: base/file_util_mac.mm |
| diff --git a/base/file_util_mac.mm b/base/file_util_mac.mm |
| index 7a994267c1ddddeaec2dfc15f7530396c974bbc6..b3196f05f663f721d42b5bd4589492233e55b98a 100644 |
| --- a/base/file_util_mac.mm |
| +++ b/base/file_util_mac.mm |
| @@ -32,6 +32,23 @@ bool GetTempDir(base::FilePath* path) { |
| return true; |
| } |
| +FilePath GetHomeDir() { |
| + NSString* tmp = NSHomeDirectory(); |
| + if (tmp != nil) { |
| + FilePath mac_home_dir = base::mac::NSStringToFilePath(NSHomeDirectory()); |
|
benwells
2014/02/18 23:14:40
Nit: why not use tmp here instead of calling NSHom
|
| + if (!mac_home_dir.empty()) |
| + return mac_home_dir; |
| + } |
| + |
| + // Fall back on temp dir if no home directory is defined. |
| + FilePath rv; |
| + if (GetTempDir(&rv)) |
| + return rv; |
| + |
| + // Last resort. |
| + return FilePath("/tmp"); |
| +} |
| + |
| bool GetShmemTempDir(bool executable, base::FilePath* path) { |
| return GetTempDir(path); |
| } |