| OLD | NEW |
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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 #if defined(OS_WIN) | 7 #if defined(OS_WIN) |
| 8 #include <windows.h> | 8 #include <windows.h> |
| 9 #include <shellapi.h> | 9 #include <shellapi.h> |
| 10 #elif defined(OS_POSIX) | 10 #elif defined(OS_POSIX) |
| (...skipping 431 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 442 for (i = other.switches_.begin(); i != other.switches_.end(); ++i) | 442 for (i = other.switches_.begin(); i != other.switches_.end(); ++i) |
| 443 switches_[i->first] = i->second; | 443 switches_[i->first] = i->second; |
| 444 } | 444 } |
| 445 | 445 |
| 446 void CommandLine::PrependWrapper(const std::wstring& wrapper) { | 446 void CommandLine::PrependWrapper(const std::wstring& wrapper) { |
| 447 if (wrapper.empty()) | 447 if (wrapper.empty()) |
| 448 return; | 448 return; |
| 449 // The wrapper may have embedded arguments (like "gdb --args"). In this case, | 449 // The wrapper may have embedded arguments (like "gdb --args"). In this case, |
| 450 // we don't pretend to do anything fancy, we just split on spaces. | 450 // we don't pretend to do anything fancy, we just split on spaces. |
| 451 std::vector<std::wstring> wrapper_and_args; | 451 std::vector<std::wstring> wrapper_and_args; |
| 452 SplitString(wrapper, ' ', &wrapper_and_args); | 452 base::SplitString(wrapper, ' ', &wrapper_and_args); |
| 453 program_ = wrapper_and_args[0]; | 453 program_ = wrapper_and_args[0]; |
| 454 command_line_string_ = wrapper + L" " + command_line_string_; | 454 command_line_string_ = wrapper + L" " + command_line_string_; |
| 455 } | 455 } |
| 456 | 456 |
| 457 #elif defined(OS_POSIX) | 457 #elif defined(OS_POSIX) |
| 458 void CommandLine::AppendSwitch(const std::string& switch_string) { | 458 void CommandLine::AppendSwitch(const std::string& switch_string) { |
| 459 argv_.push_back(kSwitchPrefixes[0] + switch_string); | 459 argv_.push_back(kSwitchPrefixes[0] + switch_string); |
| 460 switches_[switch_string] = ""; | 460 switches_[switch_string] = ""; |
| 461 } | 461 } |
| 462 | 462 |
| (...skipping 30 matching lines...) Expand all Loading... |
| 493 argv_.push_back(other.argv_[i]); | 493 argv_.push_back(other.argv_[i]); |
| 494 std::map<std::string, StringType>::const_iterator i; | 494 std::map<std::string, StringType>::const_iterator i; |
| 495 for (i = other.switches_.begin(); i != other.switches_.end(); ++i) | 495 for (i = other.switches_.begin(); i != other.switches_.end(); ++i) |
| 496 switches_[i->first] = i->second; | 496 switches_[i->first] = i->second; |
| 497 } | 497 } |
| 498 | 498 |
| 499 void CommandLine::PrependWrapper(const std::string& wrapper) { | 499 void CommandLine::PrependWrapper(const std::string& wrapper) { |
| 500 // The wrapper may have embedded arguments (like "gdb --args"). In this case, | 500 // The wrapper may have embedded arguments (like "gdb --args"). In this case, |
| 501 // we don't pretend to do anything fancy, we just split on spaces. | 501 // we don't pretend to do anything fancy, we just split on spaces. |
| 502 std::vector<std::string> wrapper_and_args; | 502 std::vector<std::string> wrapper_and_args; |
| 503 SplitString(wrapper, ' ', &wrapper_and_args); | 503 base::SplitString(wrapper, ' ', &wrapper_and_args); |
| 504 argv_.insert(argv_.begin(), wrapper_and_args.begin(), wrapper_and_args.end()); | 504 argv_.insert(argv_.begin(), wrapper_and_args.begin(), wrapper_and_args.end()); |
| 505 } | 505 } |
| 506 | 506 |
| 507 #endif | 507 #endif |
| 508 | 508 |
| 509 void CommandLine::AppendArgPath(const FilePath& path) { | 509 void CommandLine::AppendArgPath(const FilePath& path) { |
| 510 AppendArgNative(path.value()); | 510 AppendArgNative(path.value()); |
| 511 } | 511 } |
| 512 | 512 |
| 513 void CommandLine::AppendSwitchPath(const std::string& switch_string, | 513 void CommandLine::AppendSwitchPath(const std::string& switch_string, |
| (...skipping 14 matching lines...) Expand all Loading... |
| 528 | 528 |
| 529 // private | 529 // private |
| 530 CommandLine::CommandLine() { | 530 CommandLine::CommandLine() { |
| 531 } | 531 } |
| 532 | 532 |
| 533 // static | 533 // static |
| 534 CommandLine* CommandLine::ForCurrentProcessMutable() { | 534 CommandLine* CommandLine::ForCurrentProcessMutable() { |
| 535 DCHECK(current_process_commandline_); | 535 DCHECK(current_process_commandline_); |
| 536 return current_process_commandline_; | 536 return current_process_commandline_; |
| 537 } | 537 } |
| OLD | NEW |