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

Side by Side Diff: chrome/installer/util/logging_installer.cc

Issue 18286004: Move PathExists to base namespace. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 5 months 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
52 int64 offset = log_size - kTruncatedInstallerLogFileSize; 52 int64 offset = log_size - kTruncatedInstallerLogFileSize;
53 std::string old_log_data(kTruncatedInstallerLogFileSize, 0); 53 std::string old_log_data(kTruncatedInstallerLogFileSize, 0);
54 int bytes_read = base::ReadPlatformFile(old_log_file, 54 int bytes_read = base::ReadPlatformFile(old_log_file,
55 offset, 55 offset,
56 &old_log_data[0], 56 &old_log_data[0],
57 kTruncatedInstallerLogFileSize); 57 kTruncatedInstallerLogFileSize);
58 if (bytes_read > 0 && 58 if (bytes_read > 0 &&
59 (bytes_read == file_util::WriteFile(log_file, 59 (bytes_read == file_util::WriteFile(log_file,
60 &old_log_data[0], 60 &old_log_data[0],
61 bytes_read) || 61 bytes_read) ||
62 file_util::PathExists(log_file))) { 62 base::PathExists(log_file))) {
63 result = LOGFILE_TRUNCATED; 63 result = LOGFILE_TRUNCATED;
64 } 64 }
65 } 65 }
66 } else if (base::Delete(log_file, false)) { 66 } else if (base::Delete(log_file, false)) {
67 // Couldn't get sufficient access to the log file, optimistically try to 67 // Couldn't get sufficient access to the log file, optimistically try to
68 // delete it. 68 // delete it.
69 result = LOGFILE_DELETED; 69 result = LOGFILE_DELETED;
70 } 70 }
71 } 71 }
72 72
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after
124 base::FilePath log_path; 124 base::FilePath log_path;
125 if (PathService::Get(base::DIR_TEMP, &log_path)) { 125 if (PathService::Get(base::DIR_TEMP, &log_path)) {
126 log_path = log_path.Append(log_filename); 126 log_path = log_path.Append(log_filename);
127 return log_path; 127 return log_path;
128 } else { 128 } else {
129 return base::FilePath(log_filename); 129 return base::FilePath(log_filename);
130 } 130 }
131 } 131 }
132 132
133 } // namespace installer 133 } // namespace installer
OLDNEW
« no previous file with comments | « chrome/installer/util/installer_state_unittest.cc ('k') | chrome/installer/util/logging_installer_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698