OLD | NEW |
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 Loading... |
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 |
OLD | NEW |