OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 <windows.h> | 5 #include <windows.h> |
6 | 6 |
7 #include "chrome/installer/util/logging_installer.h" | 7 #include "chrome/installer/util/logging_installer.h" |
8 | 8 |
9 #include "base/command_line.h" | 9 #include "base/command_line.h" |
10 #include "base/file_util.h" | 10 #include "base/file_util.h" |
(...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
107 | 107 |
108 void EndInstallerLogging() { | 108 void EndInstallerLogging() { |
109 logging::CloseLogFile(); | 109 logging::CloseLogFile(); |
110 | 110 |
111 installer_logging_ = false; | 111 installer_logging_ = false; |
112 } | 112 } |
113 | 113 |
114 base::FilePath GetLogFilePath(const installer::MasterPreferences& prefs) { | 114 base::FilePath GetLogFilePath(const installer::MasterPreferences& prefs) { |
115 std::string path; | 115 std::string path; |
116 prefs.GetString(installer::master_preferences::kLogFile, &path); | 116 prefs.GetString(installer::master_preferences::kLogFile, &path); |
117 if (!path.empty()) { | 117 if (!path.empty()) |
118 return base::FilePath(UTF8ToWide(path)); | 118 return base::FilePath(UTF8ToWide(path)); |
119 } | |
120 | 119 |
121 std::wstring log_filename = prefs.install_chrome_frame() ? | 120 static const base::FilePath::CharType kLogFilename[] = |
122 L"chrome_frame_installer.log" : L"chrome_installer.log"; | 121 FILE_PATH_LITERAL("chrome_installer.log"); |
123 | 122 |
124 base::FilePath log_path; | 123 // Fallback to current directory if getting the temp directory fails. |
125 if (PathService::Get(base::DIR_TEMP, &log_path)) { | 124 base::FilePath tmp_path; |
126 log_path = log_path.Append(log_filename); | 125 ignore_result(PathService::Get(base::DIR_TEMP, &tmp_path)); |
127 return log_path; | 126 return tmp_path.Append(kLogFilename); |
128 } else { | |
129 return base::FilePath(log_filename); | |
130 } | |
131 } | 127 } |
132 | 128 |
133 } // namespace installer | 129 } // namespace installer |
OLD | NEW |