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

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

Issue 25153002: Enable compiling GN by default. (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set:  Created 7 years, 2 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
« no previous file with comments | « tools/gn/function_exec_script.cc ('k') | tools/gn/input_file_manager.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 58 matching lines...) Expand 10 before | Expand all | Expand 10 after
69 69
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 (!file_util::CreateDirectory(file_path.DirName())) { 74 if (!file_util::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 if (file_util::WriteFile(file_path, 79 int int_size = static_cast<int>(contents_string.size());
80 contents_string.c_str(), contents_string.size()) 80 if (file_util::WriteFile(file_path, contents_string.c_str(), int_size)
81 != static_cast<int>(contents_string.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 | « tools/gn/function_exec_script.cc ('k') | tools/gn/input_file_manager.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698