diff options
author | tommi@chromium.org <tommi@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-11-15 04:17:52 +0000 |
---|---|---|
committer | tommi@chromium.org <tommi@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-11-15 04:17:52 +0000 |
commit | e6124ad5561dd4c448c9e76c6ee9a0ceff96412d (patch) | |
tree | 82b3138919c255a79ab82a2652219cd3e08e4411 /base/command_line.cc | |
parent | c623add7ea499ec7ed90985b5adea97f9185354f (diff) | |
download | chromium_src-e6124ad5561dd4c448c9e76c6ee9a0ceff96412d.zip chromium_src-e6124ad5561dd4c448c9e76c6ee9a0ceff96412d.tar.gz chromium_src-e6124ad5561dd4c448c9e76c6ee9a0ceff96412d.tar.bz2 |
Attempt to reland http://codereview.chromium.org/4928002/
For some reason the Win bot failed to compile the sandbox unit test.
Trybots and my machines don't have these build problems, so I'm going to try again, unchanged.
Original description:
Changing the installer switches from wchar_t[] to char[].
Because of this I'm also refactoring some code that before
was using wstring to build command lines by hand instead of
using the CommandLine class. Now we use CommandLine.
To get this to work correctly, I also needed to fix CommandLine::AppendArguments so I added a little test for it.
TEST=There should be no changes in functionality. Run all installer tests.
BUG=61609
TBR=robertshield
Review URL: http://codereview.chromium.org/4989001
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@66096 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'base/command_line.cc')
-rw-r--r-- | base/command_line.cc | 19 |
1 files changed, 16 insertions, 3 deletions
diff --git a/base/command_line.cc b/base/command_line.cc index 3308e80..b335e7c 100644 --- a/base/command_line.cc +++ b/base/command_line.cc @@ -431,7 +431,14 @@ void CommandLine::AppendArguments(const CommandLine& other, // Verify include_program is used correctly. // Logic could be shorter but this is clearer. DCHECK_EQ(include_program, !other.GetProgram().empty()); - command_line_string_ += L" " + other.command_line_string_; + if (include_program) + program_ = other.program_; + + if (!command_line_string_.empty()) + command_line_string_ += L' '; + + command_line_string_ += other.command_line_string_; + std::map<std::string, StringType>::const_iterator i; for (i = other.switches_.begin(); i != other.switches_.end(); ++i) switches_[i->first] = i->second; @@ -482,9 +489,15 @@ void CommandLine::AppendArguments(const CommandLine& other, // Verify include_program is used correctly. // Logic could be shorter but this is clearer. DCHECK_EQ(include_program, !other.GetProgram().empty()); - size_t first_arg = include_program ? 0 : 1; - for (size_t i = first_arg; i < other.argv_.size(); ++i) + + if (include_program) + argv_[0] = other.argv_[0]; + + // Skip the first arg when copying since it's the program but push all + // arguments to our arg vector. + for (size_t i = 1; i < other.argv_.size(); ++i) argv_.push_back(other.argv_[i]); + std::map<std::string, StringType>::const_iterator i; for (i = other.switches_.begin(); i != other.switches_.end(); ++i) switches_[i->first] = i->second; |