| 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 "tools/gn/setup.h" | 5 #include "tools/gn/setup.h" |
| 6 | 6 |
| 7 #include <stdlib.h> | 7 #include <stdlib.h> |
| 8 | 8 |
| 9 #include <algorithm> | 9 #include <algorithm> |
| 10 #include <sstream> | 10 #include <sstream> |
| (...skipping 352 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 363 // that so we can write a file into it. Ignore errors, we'll catch the error | 363 // that so we can write a file into it. Ignore errors, we'll catch the error |
| 364 // when we try to write a file to it below. | 364 // when we try to write a file to it below. |
| 365 base::FilePath build_arg_file = | 365 base::FilePath build_arg_file = |
| 366 build_settings_.GetFullPath(GetBuildArgFile()); | 366 build_settings_.GetFullPath(GetBuildArgFile()); |
| 367 base::CreateDirectory(build_arg_file.DirName()); | 367 base::CreateDirectory(build_arg_file.DirName()); |
| 368 | 368 |
| 369 std::string contents = stream.str(); | 369 std::string contents = stream.str(); |
| 370 #if defined(OS_WIN) | 370 #if defined(OS_WIN) |
| 371 // Use Windows lineendings for this file since it will often open in | 371 // Use Windows lineendings for this file since it will often open in |
| 372 // Notepad which can't handle Unix ones. | 372 // Notepad which can't handle Unix ones. |
| 373 ReplaceSubstringsAfterOffset(&contents, 0, "\n", "\r\n"); | 373 base::ReplaceSubstringsAfterOffset(&contents, 0, "\n", "\r\n"); |
| 374 #endif | 374 #endif |
| 375 if (base::WriteFile(build_arg_file, contents.c_str(), | 375 if (base::WriteFile(build_arg_file, contents.c_str(), |
| 376 static_cast<int>(contents.size())) == -1) { | 376 static_cast<int>(contents.size())) == -1) { |
| 377 Err(Location(), "Args file could not be written.", | 377 Err(Location(), "Args file could not be written.", |
| 378 "The file is \"" + FilePathToUTF8(build_arg_file) + | 378 "The file is \"" + FilePathToUTF8(build_arg_file) + |
| 379 "\"").PrintToStdout(); | 379 "\"").PrintToStdout(); |
| 380 return false; | 380 return false; |
| 381 } | 381 } |
| 382 | 382 |
| 383 // Add a dependency on the build arguments file. If this changes, we want | 383 // Add a dependency on the build arguments file. If this changes, we want |
| (...skipping 238 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 622 if (err.has_error()) { | 622 if (err.has_error()) { |
| 623 err.PrintToStdout(); | 623 err.PrintToStdout(); |
| 624 return false; | 624 return false; |
| 625 } | 625 } |
| 626 } | 626 } |
| 627 build_settings_.set_exec_script_whitelist(whitelist.Pass()); | 627 build_settings_.set_exec_script_whitelist(whitelist.Pass()); |
| 628 } | 628 } |
| 629 | 629 |
| 630 return true; | 630 return true; |
| 631 } | 631 } |
| OLD | NEW |