Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(416)

Unified Diff: base/file_util_win.cc

Issue 11300011: Don't expand path to use long names in CreateTemporaryFileInDir. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Address comments and add a unit test Created 8 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « base/file_util_unittest.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: base/file_util_win.cc
diff --git a/base/file_util_win.cc b/base/file_util_win.cc
index 332414af170c628d0aab724e7a7856d679acf3fe..c5b2711d9c3e5860a649d810834fa8f2c9ba3bf3 100644
--- a/base/file_util_win.cc
+++ b/base/file_util_win.cc
@@ -393,15 +393,17 @@ bool CreateTemporaryFileInDir(const FilePath& dir,
return false;
}
- DWORD path_len = GetLongPathName(temp_name, temp_name, MAX_PATH);
- if (path_len > MAX_PATH + 1 || path_len == 0) {
- DPLOG(WARNING) << "Failed to get long path name for " << temp_name;
- return false;
+ wchar_t long_temp_name[MAX_PATH + 1];
asanka 2012/11/09 22:02:54 Added |long_temp_name| because I couldn't find any
+ DWORD long_name_len = GetLongPathName(temp_name, long_temp_name, MAX_PATH);
+ if (long_name_len > MAX_PATH || long_name_len == 0) {
+ // GetLongPathName() failed, but we still have a temporary file.
+ *temp_file = FilePath(temp_name);
+ return true;
}
- std::wstring temp_file_str;
- temp_file_str.assign(temp_name, path_len);
- *temp_file = FilePath(temp_file_str);
+ FilePath::StringType long_temp_name_str;
+ long_temp_name_str.assign(long_temp_name, long_name_len);
+ *temp_file = FilePath(long_temp_name_str);
return true;
}
« no previous file with comments | « base/file_util_unittest.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698