Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "base/file_util.h" | 5 #include "base/file_util.h" |
| 6 | 6 |
| 7 #include <windows.h> | 7 #include <windows.h> |
| 8 #include <shellapi.h> | 8 #include <shellapi.h> |
| 9 #include <shlobj.h> | 9 #include <shlobj.h> |
| 10 #include <time.h> | 10 #include <time.h> |
| (...skipping 410 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 421 } | 421 } |
| 422 | 422 |
| 423 bool GetTempDir(FilePath* path) { | 423 bool GetTempDir(FilePath* path) { |
| 424 wchar_t temp_path[MAX_PATH + 1]; | 424 wchar_t temp_path[MAX_PATH + 1]; |
| 425 DWORD path_len = ::GetTempPath(MAX_PATH, temp_path); | 425 DWORD path_len = ::GetTempPath(MAX_PATH, temp_path); |
| 426 if (path_len >= MAX_PATH || path_len <= 0) | 426 if (path_len >= MAX_PATH || path_len <= 0) |
| 427 return false; | 427 return false; |
| 428 // TODO(evanm): the old behavior of this function was to always strip the | 428 // TODO(evanm): the old behavior of this function was to always strip the |
| 429 // trailing slash. We duplicate this here, but it shouldn't be necessary | 429 // trailing slash. We duplicate this here, but it shouldn't be necessary |
| 430 // when everyone is using the appropriate FilePath APIs. | 430 // when everyone is using the appropriate FilePath APIs. |
| 431 std::wstring path_str(temp_path); | 431 *path = FilePath(temp_path).StripTrailingSeparators(); |
|
Erik does not do reviews
2009/10/09 14:16:33
If this changes anything for your test case, then
Mark Mentovai
2009/10/09 14:31:16
I agree. It looks like file_util::TrimTrailingSep
tkent
2009/10/09 15:09:34
You're right. As Mark wrote, TrimTrailingSeprator
| |
| 432 TrimTrailingSeparator(&path_str); | |
| 433 *path = FilePath(path_str); | |
| 434 return true; | 432 return true; |
| 435 } | 433 } |
| 436 | 434 |
| 437 bool GetShmemTempDir(FilePath* path) { | 435 bool GetShmemTempDir(FilePath* path) { |
| 438 return GetTempDir(path); | 436 return GetTempDir(path); |
| 439 } | 437 } |
| 440 | 438 |
| 441 bool CreateTemporaryFile(FilePath* path) { | 439 bool CreateTemporaryFile(FilePath* path) { |
| 442 FilePath temp_file; | 440 FilePath temp_file; |
| 443 | 441 |
| (...skipping 358 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 802 ::CloseHandle(file_mapping_); | 800 ::CloseHandle(file_mapping_); |
| 803 if (file_ != INVALID_HANDLE_VALUE) | 801 if (file_ != INVALID_HANDLE_VALUE) |
| 804 ::CloseHandle(file_); | 802 ::CloseHandle(file_); |
| 805 | 803 |
| 806 data_ = NULL; | 804 data_ = NULL; |
| 807 file_mapping_ = file_ = INVALID_HANDLE_VALUE; | 805 file_mapping_ = file_ = INVALID_HANDLE_VALUE; |
| 808 length_ = INVALID_FILE_SIZE; | 806 length_ = INVALID_FILE_SIZE; |
| 809 } | 807 } |
| 810 | 808 |
| 811 } // namespace file_util | 809 } // namespace file_util |
| OLD | NEW |