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

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

Issue 1200393002: Add more string_util functions to base namespace. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@string
Patch Set: Android Created 5 years, 6 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/command_args.cc ('k') | ui/base/webui/jstemplate_builder.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 "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
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
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 }
OLDNEW
« no previous file with comments | « tools/gn/command_args.cc ('k') | ui/base/webui/jstemplate_builder.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698