OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 "base/command_line.h" | 5 #include "base/command_line.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 #include <ostream> | 8 #include <ostream> |
9 | 9 |
10 #include "base/basictypes.h" | 10 #include "base/basictypes.h" |
(...skipping 376 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
387 if (include_program) | 387 if (include_program) |
388 SetProgram(other.GetProgram()); | 388 SetProgram(other.GetProgram()); |
389 AppendSwitchesAndArguments(this, other.argv()); | 389 AppendSwitchesAndArguments(this, other.argv()); |
390 } | 390 } |
391 | 391 |
392 void CommandLine::PrependWrapper(const CommandLine::StringType& wrapper) { | 392 void CommandLine::PrependWrapper(const CommandLine::StringType& wrapper) { |
393 if (wrapper.empty()) | 393 if (wrapper.empty()) |
394 return; | 394 return; |
395 // The wrapper may have embedded arguments (like "gdb --args"). In this case, | 395 // The wrapper may have embedded arguments (like "gdb --args"). In this case, |
396 // we don't pretend to do anything fancy, we just split on spaces. | 396 // we don't pretend to do anything fancy, we just split on spaces. |
397 StringVector wrapper_argv; | 397 StringVector wrapper_argv = SplitString( |
398 SplitString(wrapper, FILE_PATH_LITERAL(' '), &wrapper_argv); | 398 wrapper, FilePath::StringType(1, ' '), base::TRIM_WHITESPACE, |
| 399 base::SPLIT_WANT_ALL); |
399 // Prepend the wrapper and update the switches/arguments |begin_args_|. | 400 // Prepend the wrapper and update the switches/arguments |begin_args_|. |
400 argv_.insert(argv_.begin(), wrapper_argv.begin(), wrapper_argv.end()); | 401 argv_.insert(argv_.begin(), wrapper_argv.begin(), wrapper_argv.end()); |
401 begin_args_ += wrapper_argv.size(); | 402 begin_args_ += wrapper_argv.size(); |
402 } | 403 } |
403 | 404 |
404 #if defined(OS_WIN) | 405 #if defined(OS_WIN) |
405 void CommandLine::ParseFromString(const string16& command_line) { | 406 void CommandLine::ParseFromString(const string16& command_line) { |
406 string16 command_line_string; | 407 string16 command_line_string; |
407 TrimWhitespace(command_line, TRIM_ALL, &command_line_string); | 408 TrimWhitespace(command_line, TRIM_ALL, &command_line_string); |
408 if (command_line_string.empty()) | 409 if (command_line_string.empty()) |
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
464 return params; | 465 return params; |
465 } | 466 } |
466 | 467 |
467 void CommandLine::ResetStringPieces() { | 468 void CommandLine::ResetStringPieces() { |
468 switches_by_stringpiece_.clear(); | 469 switches_by_stringpiece_.clear(); |
469 for (const auto& entry : switches_) | 470 for (const auto& entry : switches_) |
470 switches_by_stringpiece_[entry.first] = &(entry.second); | 471 switches_by_stringpiece_[entry.first] = &(entry.second); |
471 } | 472 } |
472 | 473 |
473 } // namespace base | 474 } // namespace base |
OLD | NEW |