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..ac20661dc1e623f2e3302f0e01806cb7a28560a5 100644 |
| --- a/chrome/browser/file_select_helper_mac.mm |
| +++ b/chrome/browser/file_select_helper_mac.mm |
| @@ -11,6 +11,7 @@ |
| #include "base/files/file_path.h" |
| #include "base/files/file_util.h" |
| #include "base/mac/foundation_util.h" |
| +#include "base/strings/sys_string_conversions.h" |
| #include "content/public/browser/browser_thread.h" |
| #include "third_party/zlib/google/zip.h" |
| #include "ui/shell_dialogs/selected_file_info.h" |
| @@ -20,18 +21,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. |
| 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 = dest.Append(base::SysNSStringToUTF8(bundleID)); |
|
Mark Mentovai
2017/03/01 02:33:49
For things that become file paths, this is better
iannucci
2017/03/01 02:49:13
Done.
|
| + |
| + dest = dest.Append("zip_cache"); |
| - [dest appendFormat:@"%@/zip_cache/%@", |
| - [[NSBundle mainBundle] bundleIdentifier], |
| - [[NSProcessInfo processInfo] globallyUniqueString]]; |
| + NSString* GUID = [[NSProcessInfo processInfo] globallyUniqueString]; |
|
Mark Mentovai
2017/03/01 02:33:49
We name variables in lowercase, this should be “gu
iannucci
2017/03/01 02:49:13
Done.
|
| + dest = dest.Append(base::SysNSStringToUTF8(GUID)); |
| - return base::mac::NSStringToFilePath(dest); |
| + return dest; |
| } |
| // Returns the path of the package and its components relative to the package's |