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

Side by Side Diff: tools/gn/function_write_file.cc

Issue 184563006: Move WriteFile and WriteFileDescriptor from file_util to base namespace. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 9 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
« no previous file with comments | « third_party/zlib/google/zip_unittest.cc ('k') | tools/gn/gyp_target_writer.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2013 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 <iostream> 5 #include <iostream>
6 #include <sstream> 6 #include <sstream>
7 7
8 #include "base/file_util.h" 8 #include "base/file_util.h"
9 #include "base/strings/string_split.h" 9 #include "base/strings/string_split.h"
10 #include "base/strings/string_util.h" 10 #include "base/strings/string_util.h"
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after
70 // Write file, creating the directory if necessary. 70 // Write file, creating the directory if necessary.
71 base::FilePath file_path = 71 base::FilePath file_path =
72 scope->settings()->build_settings()->GetFullPath(source_file); 72 scope->settings()->build_settings()->GetFullPath(source_file);
73 const std::string& contents_string = contents.str(); 73 const std::string& contents_string = contents.str();
74 if (!base::CreateDirectory(file_path.DirName())) { 74 if (!base::CreateDirectory(file_path.DirName())) {
75 *err = Err(function->function(), "Unable to create directory.", 75 *err = Err(function->function(), "Unable to create directory.",
76 "I was using \"" + FilePathToUTF8(file_path.DirName()) + "\"."); 76 "I was using \"" + FilePathToUTF8(file_path.DirName()) + "\".");
77 return Value(); 77 return Value();
78 } 78 }
79 int int_size = static_cast<int>(contents_string.size()); 79 int int_size = static_cast<int>(contents_string.size());
80 if (file_util::WriteFile(file_path, contents_string.c_str(), int_size) 80 if (base::WriteFile(file_path, contents_string.c_str(), int_size)
81 != int_size) { 81 != int_size) {
82 *err = Err(function->function(), "Unable to write file.", 82 *err = Err(function->function(), "Unable to write file.",
83 "I was writing \"" + FilePathToUTF8(file_path) + "\"."); 83 "I was writing \"" + FilePathToUTF8(file_path) + "\".");
84 return Value(); 84 return Value();
85 } 85 }
86 return Value(); 86 return Value();
87 } 87 }
88 88
89 } // namespace functions 89 } // namespace functions
OLDNEW
« no previous file with comments | « third_party/zlib/google/zip_unittest.cc ('k') | tools/gn/gyp_target_writer.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698