Chromium Code Reviews| Index: base/logging.cc |
| diff --git a/base/logging.cc b/base/logging.cc |
| index 98cecd094fd84e7312c9a3e9998dfb44cfd05925..78293d920b2b54ebd73f304f15b0e6aadc0037a7 100644 |
| --- a/base/logging.cc |
| +++ b/base/logging.cc |
| @@ -13,8 +13,6 @@ |
| #if defined(OS_WIN) |
| #include <io.h> |
| #include <windows.h> |
| -#include "base/files/file_path.h" |
| -#include "base/files/file_util.h" |
| typedef HANDLE FileHandle; |
| typedef HANDLE MutexHandle; |
| // Windows warns on using write(). It prefers _write(). |
| @@ -290,12 +288,17 @@ bool InitializeLogFileHandle() { |
| OPEN_ALWAYS, FILE_ATTRIBUTE_NORMAL, nullptr); |
| if (g_log_file == INVALID_HANDLE_VALUE || g_log_file == nullptr) { |
| // try the current directory |
| - base::FilePath file_path; |
| - if (!base::GetCurrentDirectory(&file_path)) |
| + wchar_t system_buffer[MAX_PATH]; |
| + system_buffer[0] = 0; |
| + DWORD len = ::GetCurrentDirectory(MAX_PATH, system_buffer); |
| + if (len == 0 || len > MAX_PATH) |
|
grt (UTC plus 2)
2016/06/10 14:20:00
nit: MAX_PATH -> arraysize(system_buffer)
ananta
2016/06/10 18:29:57
Done.
|
| return false; |
| - *g_log_file_name = file_path.Append( |
| - FILE_PATH_LITERAL("debug.log")).value(); |
| + *g_log_file_name = system_buffer; |
| + // Append a trailing backslash if needed. |
| + if ((*g_log_file_name)[g_log_file_name->length() - 1] != L'\\') |
|
grt (UTC plus 2)
2016/06/10 14:20:00
? if (g_log_file_name->back() != L'\\')
ananta
2016/06/10 18:29:57
Done.
|
| + *g_log_file_name += L"\\"; |
| + *g_log_file_name += L"debug.log"; |
| g_log_file = CreateFile(g_log_file_name->c_str(), FILE_APPEND_DATA, |
| FILE_SHARE_READ | FILE_SHARE_WRITE, nullptr, |