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

Unified Diff: base/command_line.cc

Issue 4989001: Attempt to reland http://codereview.chromium.org/4928002/... (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 10 years, 1 month 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | base/command_line_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: base/command_line.cc
===================================================================
--- base/command_line.cc (revision 66087)
+++ base/command_line.cc (working copy)
@@ -431,7 +431,14 @@
// 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 @@
// 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;
« no previous file with comments | « no previous file | base/command_line_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698