OLD | NEW |
1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2008 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 #endif | 10 #endif |
(...skipping 316 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
327 // Logic could be shorter but this is clearer. | 327 // Logic could be shorter but this is clearer. |
328 DCHECK(include_program ? !other.program().empty() : other.program().empty()); | 328 DCHECK(include_program ? !other.program().empty() : other.program().empty()); |
329 | 329 |
330 size_t first_arg = include_program ? 0 : 1; | 330 size_t first_arg = include_program ? 0 : 1; |
331 for (size_t i = first_arg; i < other.argv_.size(); ++i) | 331 for (size_t i = first_arg; i < other.argv_.size(); ++i) |
332 argv_.push_back(other.argv_[i]); | 332 argv_.push_back(other.argv_[i]); |
333 std::map<std::string, StringType>::const_iterator i; | 333 std::map<std::string, StringType>::const_iterator i; |
334 for (i = other.switches_.begin(); i != other.switches_.end(); ++i) | 334 for (i = other.switches_.begin(); i != other.switches_.end(); ++i) |
335 switches_[i->first] = i->second; | 335 switches_[i->first] = i->second; |
336 } | 336 } |
| 337 |
| 338 void CommandLine::PrependWrapper(const std::wstring& wrapper_wide) { |
| 339 // The wrapper may have embedded arguments (like "gdb --args"). In this case, |
| 340 // we don't pretend to do anything fancy, we just split on spaces. |
| 341 const std::string wrapper = WideToASCII(wrapper_wide); |
| 342 std::vector<std::string> wrapper_and_args; |
| 343 SplitString(wrapper, ' ', &wrapper_and_args); |
| 344 argv_.insert(argv_.begin(), wrapper_and_args.begin(), wrapper_and_args.end()); |
| 345 } |
| 346 |
337 #endif | 347 #endif |
338 | 348 |
OLD | NEW |