Chromium Code Reviews| Index: chrome/browser/file_select_helper_mac.mm |
| diff --git a/chrome/browser/file_select_helper_mac.mm b/chrome/browser/file_select_helper_mac.mm |
| index 2fdc57923d89d5f85f3039c61731c152fd150145..db910f8076e40e7ba2f5631ee303ac80f02428e7 100644 |
| --- a/chrome/browser/file_select_helper_mac.mm |
| +++ b/chrome/browser/file_select_helper_mac.mm |
| @@ -20,18 +20,24 @@ namespace { |
| // Given the |path| of a package, returns the destination that the package |
| // should be zipped to. Returns an empty path on any errors. |
|
iannucci
2017/02/24 20:56:01
This comment seems... misleading at best? `path` i
|
| base::FilePath ZipDestination(const base::FilePath& path) { |
| - NSMutableString* dest = |
| - [NSMutableString stringWithString:NSTemporaryDirectory()]; |
| + base::FilePath dest; |
| - // Couldn't get the temporary directory. |
| - if (!dest) |
| + if (!base::GetTempDir(dest)) { |
| + // Couldn't get the temporary directory. |
| return base::FilePath(); |
| + } |
| + |
| + // TMPDIR/<bundleID>/zip_cache/<GUID> |
| + |
| + NSString* bundleID = [[NSBundle mainBundle] bundleIdentifier]; |
| + dest.Append(base::mac::NSStringToString(bundleID)) |
| + |
| + dest.Append("zip_cache") |
| - [dest appendFormat:@"%@/zip_cache/%@", |
| - [[NSBundle mainBundle] bundleIdentifier], |
| - [[NSProcessInfo processInfo] globallyUniqueString]]; |
| + NSString* GUID = [[NSProcessInfo processInfo] globallyUniqueString]; |
| + dest.Append(base::mac::NSStringToString(GUID)) |
| - return base::mac::NSStringToFilePath(dest); |
| + return dest; |
| } |
| // Returns the path of the package and its components relative to the package's |