blob: fb7c81376ba4bfce5936b4298989b2144862c0fb [file] [log] [blame]
[email protected]72e2e2422012-02-27 18:38:121// Copyright (c) 2012 The Chromium Authors. All rights reserved.
license.botbf09a502008-08-24 00:55:552// Use of this source code is governed by a BSD-style license that can be
3// found in the LICENSE file.
initial.commitd7cae122008-07-26 21:49:384
[email protected]f3adb5c2008-08-07 20:07:325#include "base/command_line.h"
6
initial.commitd7cae122008-07-26 21:49:387#include <algorithm>
[email protected]2edc2862011-04-04 18:04:378#include <ostream>
initial.commitd7cae122008-07-26 21:49:389
[email protected]2edc2862011-04-04 18:04:3710#include "base/basictypes.h"
[email protected]57999812013-02-24 05:40:5211#include "base/files/file_path.h"
initial.commitd7cae122008-07-26 21:49:3812#include "base/logging.h"
[email protected]5ae0b763e2013-02-07 23:01:3913#include "base/strings/string_split.h"
[email protected]251cd6e52013-06-11 13:36:3714#include "base/strings/string_util.h"
[email protected]a4ea1f12013-06-07 18:37:0715#include "base/strings/utf_string_conversions.h"
[email protected]74e9fa22010-12-29 21:06:4316#include "build/build_config.h"
initial.commitd7cae122008-07-26 21:49:3817
[email protected]74e9fa22010-12-29 21:06:4318#if defined(OS_WIN)
19#include <windows.h>
20#include <shellapi.h>
[email protected]7f113f32009-09-10 18:02:1721#endif
22
[email protected]2f3b1cc2014-03-17 23:07:1523namespace base {
[email protected]04af979a2013-02-16 04:12:2624
[email protected]bb975362009-01-21 01:00:2225CommandLine* CommandLine::current_process_commandline_ = NULL;
initial.commitd7cae122008-07-26 21:49:3826
[email protected]06cc083a2011-03-01 02:28:4227namespace {
[email protected]2f3b1cc2014-03-17 23:07:1528
[email protected]a40ca4302011-05-14 01:10:2429const CommandLine::CharType kSwitchTerminator[] = FILE_PATH_LITERAL("--");
30const CommandLine::CharType kSwitchValueSeparator[] = FILE_PATH_LITERAL("=");
[email protected]bf98a0e12013-09-25 23:36:0031
[email protected]06cc083a2011-03-01 02:28:4232// Since we use a lazy match, make sure that longer versions (like "--") are
33// listed before shorter versions (like "-") of similar prefixes.
[email protected]5d426332008-08-08 20:46:2134#if defined(OS_WIN)
[email protected]bf98a0e12013-09-25 23:36:0035// By putting slash last, we can control whether it is treaded as a switch
36// value by changing the value of switch_prefix_count to be one less than
37// the array size.
[email protected]a40ca4302011-05-14 01:10:2438const CommandLine::CharType* const kSwitchPrefixes[] = {L"--", L"-", L"/"};
[email protected]5d426332008-08-08 20:46:2139#elif defined(OS_POSIX)
[email protected]1a48f312008-08-12 01:14:3740// Unixes don't use slash as a switch.
[email protected]a40ca4302011-05-14 01:10:2441const CommandLine::CharType* const kSwitchPrefixes[] = {"--", "-"};
[email protected]5d426332008-08-08 20:46:2142#endif
[email protected]bf98a0e12013-09-25 23:36:0043size_t switch_prefix_count = arraysize(kSwitchPrefixes);
initial.commitd7cae122008-07-26 21:49:3844
[email protected]a40ca4302011-05-14 01:10:2445size_t GetSwitchPrefixLength(const CommandLine::StringType& string) {
[email protected]bf98a0e12013-09-25 23:36:0046 for (size_t i = 0; i < switch_prefix_count; ++i) {
[email protected]a40ca4302011-05-14 01:10:2447 CommandLine::StringType prefix(kSwitchPrefixes[i]);
[email protected]1fa39f02011-09-13 15:45:3448 if (string.compare(0, prefix.length(), prefix) == 0)
[email protected]a40ca4302011-05-14 01:10:2449 return prefix.length();
50 }
51 return 0;
initial.commitd7cae122008-07-26 21:49:3852}
[email protected]0fd23af2011-02-20 06:33:0453
[email protected]a40ca4302011-05-14 01:10:2454// Fills in |switch_string| and |switch_value| if |string| is a switch.
55// This will preserve the input switch prefix in the output |switch_string|.
56bool IsSwitch(const CommandLine::StringType& string,
57 CommandLine::StringType* switch_string,
58 CommandLine::StringType* switch_value) {
59 switch_string->clear();
60 switch_value->clear();
[email protected]21e342f2012-10-19 06:19:5961 size_t prefix_length = GetSwitchPrefixLength(string);
62 if (prefix_length == 0 || prefix_length == string.length())
[email protected]a40ca4302011-05-14 01:10:2463 return false;
64
65 const size_t equals_position = string.find(kSwitchValueSeparator);
66 *switch_string = string.substr(0, equals_position);
67 if (equals_position != CommandLine::StringType::npos)
68 *switch_value = string.substr(equals_position + 1);
69 return true;
70}
71
72// Append switches and arguments, keeping switches before arguments.
thestig8badc792014-12-04 22:14:2273void AppendSwitchesAndArguments(CommandLine* command_line,
[email protected]a40ca4302011-05-14 01:10:2474 const CommandLine::StringVector& argv) {
75 bool parse_switches = true;
76 for (size_t i = 1; i < argv.size(); ++i) {
77 CommandLine::StringType arg = argv[i];
[email protected]2f3b1cc2014-03-17 23:07:1578 TrimWhitespace(arg, TRIM_ALL, &arg);
[email protected]a40ca4302011-05-14 01:10:2479
80 CommandLine::StringType switch_string;
81 CommandLine::StringType switch_value;
82 parse_switches &= (arg != kSwitchTerminator);
83 if (parse_switches && IsSwitch(arg, &switch_string, &switch_value)) {
84#if defined(OS_WIN)
thestig8badc792014-12-04 22:14:2285 command_line->AppendSwitchNative(UTF16ToASCII(switch_string),
86 switch_value);
[email protected]a40ca4302011-05-14 01:10:2487#elif defined(OS_POSIX)
thestig8badc792014-12-04 22:14:2288 command_line->AppendSwitchNative(switch_string, switch_value);
[email protected]a40ca4302011-05-14 01:10:2489#endif
90 } else {
thestig8badc792014-12-04 22:14:2291 command_line->AppendArgNative(arg);
[email protected]a40ca4302011-05-14 01:10:2492 }
93 }
94}
95
96// Lowercase switches for backwards compatiblity *on Windows*.
97std::string LowerASCIIOnWindows(const std::string& string) {
98#if defined(OS_WIN)
thestig8badc792014-12-04 22:14:2299 return StringToLowerASCII(string);
[email protected]a40ca4302011-05-14 01:10:24100#elif defined(OS_POSIX)
101 return string;
102#endif
103}
104
105
106#if defined(OS_WIN)
107// Quote a string as necessary for CommandLineToArgvW compatiblity *on Windows*.
thestig8badc792014-12-04 22:14:22108string16 QuoteForCommandLineToArgvW(const string16& arg,
109 bool quote_placeholders) {
[email protected]0fd23af2011-02-20 06:33:04110 // We follow the quoting rules of CommandLineToArgvW.
111 // http://msdn.microsoft.com/en-us/library/17w5ykft.aspx
thestig8badc792014-12-04 22:14:22112 string16 quotable_chars(L" \\\"");
mgiucac974d5102014-10-01 09:24:51113 // We may also be required to quote '%', which is commonly used in a command
114 // line as a placeholder. (It may be substituted for a string with spaces.)
115 if (quote_placeholders)
116 quotable_chars.push_back(L'%');
thestig8badc792014-12-04 22:14:22117 if (arg.find_first_of(quotable_chars) == string16::npos) {
[email protected]0fd23af2011-02-20 06:33:04118 // No quoting necessary.
119 return arg;
120 }
121
thestig8badc792014-12-04 22:14:22122 string16 out;
[email protected]0fd23af2011-02-20 06:33:04123 out.push_back(L'"');
124 for (size_t i = 0; i < arg.size(); ++i) {
125 if (arg[i] == '\\') {
126 // Find the extent of this run of backslashes.
127 size_t start = i, end = start + 1;
thestig8badc792014-12-04 22:14:22128 for (; end < arg.size() && arg[end] == '\\'; ++end) {}
[email protected]0fd23af2011-02-20 06:33:04129 size_t backslash_count = end - start;
130
131 // Backslashes are escapes only if the run is followed by a double quote.
132 // Since we also will end the string with a double quote, we escape for
133 // either a double quote or the end of the string.
134 if (end == arg.size() || arg[end] == '"') {
135 // To quote, we need to output 2x as many backslashes.
136 backslash_count *= 2;
137 }
138 for (size_t j = 0; j < backslash_count; ++j)
139 out.push_back('\\');
140
141 // Advance i to one before the end to balance i++ in loop.
142 i = end - 1;
143 } else if (arg[i] == '"') {
144 out.push_back('\\');
145 out.push_back('"');
146 } else {
147 out.push_back(arg[i]);
148 }
149 }
150 out.push_back('"');
151
152 return out;
153}
[email protected]bb975362009-01-21 01:00:22154#endif
initial.commitd7cae122008-07-26 21:49:38155
[email protected]06cc083a2011-03-01 02:28:42156} // namespace
157
[email protected]a40ca4302011-05-14 01:10:24158CommandLine::CommandLine(NoProgram no_program)
159 : argv_(1),
160 begin_args_(1) {
[email protected]06cc083a2011-03-01 02:28:42161}
162
[email protected]a40ca4302011-05-14 01:10:24163CommandLine::CommandLine(const FilePath& program)
164 : argv_(1),
165 begin_args_(1) {
166 SetProgram(program);
[email protected]06cc083a2011-03-01 02:28:42167}
168
[email protected]a40ca4302011-05-14 01:10:24169CommandLine::CommandLine(int argc, const CommandLine::CharType* const* argv)
170 : argv_(1),
171 begin_args_(1) {
[email protected]06cc083a2011-03-01 02:28:42172 InitFromArgv(argc, argv);
173}
174
[email protected]a40ca4302011-05-14 01:10:24175CommandLine::CommandLine(const StringVector& argv)
176 : argv_(1),
177 begin_args_(1) {
[email protected]06cc083a2011-03-01 02:28:42178 InitFromArgv(argv);
179}
[email protected]06cc083a2011-03-01 02:28:42180
[email protected]acbeb3d2011-03-01 20:47:58181CommandLine::~CommandLine() {
182}
183
[email protected]bf98a0e12013-09-25 23:36:00184#if defined(OS_WIN)
185// static
186void CommandLine::set_slash_is_not_a_switch() {
187 // The last switch prefix should be slash, so adjust the size to skip it.
188 DCHECK(wcscmp(kSwitchPrefixes[arraysize(kSwitchPrefixes) - 1], L"/") == 0);
189 switch_prefix_count = arraysize(kSwitchPrefixes) - 1;
190}
191#endif
192
[email protected]06cc083a2011-03-01 02:28:42193// static
[email protected]72e2e2422012-02-27 18:38:12194bool CommandLine::Init(int argc, const char* const* argv) {
[email protected]f96fe2c42011-07-13 18:03:34195 if (current_process_commandline_) {
196 // If this is intentional, Reset() must be called first. If we are using
197 // the shared build mode, we have to share a single object across multiple
198 // shared libraries.
[email protected]72e2e2422012-02-27 18:38:12199 return false;
[email protected]f96fe2c42011-07-13 18:03:34200 }
201
[email protected]a40ca4302011-05-14 01:10:24202 current_process_commandline_ = new CommandLine(NO_PROGRAM);
[email protected]06cc083a2011-03-01 02:28:42203#if defined(OS_WIN)
204 current_process_commandline_->ParseFromString(::GetCommandLineW());
205#elif defined(OS_POSIX)
206 current_process_commandline_->InitFromArgv(argc, argv);
207#endif
[email protected]72e2e2422012-02-27 18:38:12208
209 return true;
[email protected]06cc083a2011-03-01 02:28:42210}
211
212// static
213void CommandLine::Reset() {
214 DCHECK(current_process_commandline_);
215 delete current_process_commandline_;
216 current_process_commandline_ = NULL;
217}
218
219// static
220CommandLine* CommandLine::ForCurrentProcess() {
221 DCHECK(current_process_commandline_);
222 return current_process_commandline_;
[email protected]3a3d47472010-07-15 21:03:54223}
224
[email protected]2bf64a92013-07-11 23:10:40225// static
226bool CommandLine::InitializedForCurrentProcess() {
227 return !!current_process_commandline_;
228}
229
[email protected]f3adb5c2008-08-07 20:07:32230#if defined(OS_WIN)
[email protected]06cc083a2011-03-01 02:28:42231// static
thestig8badc792014-12-04 22:14:22232CommandLine CommandLine::FromString(const string16& command_line) {
[email protected]a40ca4302011-05-14 01:10:24233 CommandLine cmd(NO_PROGRAM);
[email protected]06cc083a2011-03-01 02:28:42234 cmd.ParseFromString(command_line);
235 return cmd;
236}
[email protected]a40ca4302011-05-14 01:10:24237#endif
[email protected]06cc083a2011-03-01 02:28:42238
[email protected]a40ca4302011-05-14 01:10:24239void CommandLine::InitFromArgv(int argc,
240 const CommandLine::CharType* const* argv) {
241 StringVector new_argv;
[email protected]06cc083a2011-03-01 02:28:42242 for (int i = 0; i < argc; ++i)
[email protected]a40ca4302011-05-14 01:10:24243 new_argv.push_back(argv[i]);
244 InitFromArgv(new_argv);
[email protected]51343d5a2009-10-26 22:39:33245}
246
[email protected]06cc083a2011-03-01 02:28:42247void CommandLine::InitFromArgv(const StringVector& argv) {
[email protected]a40ca4302011-05-14 01:10:24248 argv_ = StringVector(1);
[email protected]93660ab32013-06-18 08:19:18249 switches_.clear();
[email protected]a40ca4302011-05-14 01:10:24250 begin_args_ = 1;
251 SetProgram(argv.empty() ? FilePath() : FilePath(argv[0]));
thestig8badc792014-12-04 22:14:22252 AppendSwitchesAndArguments(this, argv);
[email protected]06cc083a2011-03-01 02:28:42253}
[email protected]06cc083a2011-03-01 02:28:42254
[email protected]06cc083a2011-03-01 02:28:42255FilePath CommandLine::GetProgram() const {
[email protected]06cc083a2011-03-01 02:28:42256 return FilePath(argv_[0]);
[email protected]a40ca4302011-05-14 01:10:24257}
258
259void CommandLine::SetProgram(const FilePath& program) {
[email protected]2f3b1cc2014-03-17 23:07:15260 TrimWhitespace(program.value(), TRIM_ALL, &argv_[0]);
[email protected]06cc083a2011-03-01 02:28:42261}
262
263bool CommandLine::HasSwitch(const std::string& switch_string) const {
[email protected]a40ca4302011-05-14 01:10:24264 return switches_.find(LowerASCIIOnWindows(switch_string)) != switches_.end();
[email protected]06cc083a2011-03-01 02:28:42265}
266
267std::string CommandLine::GetSwitchValueASCII(
268 const std::string& switch_string) const {
[email protected]a40ca4302011-05-14 01:10:24269 StringType value = GetSwitchValueNative(switch_string);
[email protected]bd6fc2f2014-03-17 23:55:43270 if (!IsStringASCII(value)) {
[email protected]a42d4632011-10-26 21:48:00271 DLOG(WARNING) << "Value of switch (" << switch_string << ") must be ASCII.";
272 return std::string();
[email protected]06cc083a2011-03-01 02:28:42273 }
274#if defined(OS_WIN)
[email protected]2f3b1cc2014-03-17 23:07:15275 return UTF16ToASCII(value);
[email protected]06cc083a2011-03-01 02:28:42276#else
277 return value;
278#endif
279}
280
281FilePath CommandLine::GetSwitchValuePath(
282 const std::string& switch_string) const {
283 return FilePath(GetSwitchValueNative(switch_string));
284}
285
286CommandLine::StringType CommandLine::GetSwitchValueNative(
287 const std::string& switch_string) const {
[email protected]9098e352013-11-21 12:05:28288 SwitchMap::const_iterator result =
289 switches_.find(LowerASCIIOnWindows(switch_string));
[email protected]a40ca4302011-05-14 01:10:24290 return result == switches_.end() ? StringType() : result->second;
[email protected]06cc083a2011-03-01 02:28:42291}
292
[email protected]06cc083a2011-03-01 02:28:42293void CommandLine::AppendSwitch(const std::string& switch_string) {
[email protected]a40ca4302011-05-14 01:10:24294 AppendSwitchNative(switch_string, StringType());
[email protected]06cc083a2011-03-01 02:28:42295}
296
297void CommandLine::AppendSwitchPath(const std::string& switch_string,
298 const FilePath& path) {
299 AppendSwitchNative(switch_string, path.value());
300}
301
302void CommandLine::AppendSwitchNative(const std::string& switch_string,
303 const CommandLine::StringType& value) {
[email protected]a40ca4302011-05-14 01:10:24304 std::string switch_key(LowerASCIIOnWindows(switch_string));
[email protected]06cc083a2011-03-01 02:28:42305#if defined(OS_WIN)
thestig8badc792014-12-04 22:14:22306 StringType combined_switch_string(ASCIIToUTF16(switch_key));
[email protected]06cc083a2011-03-01 02:28:42307#elif defined(OS_POSIX)
[email protected]a40ca4302011-05-14 01:10:24308 StringType combined_switch_string(switch_string);
309#endif
310 size_t prefix_length = GetSwitchPrefixLength(combined_switch_string);
311 switches_[switch_key.substr(prefix_length)] = value;
312 // Preserve existing switch prefixes in |argv_|; only append one if necessary.
313 if (prefix_length == 0)
314 combined_switch_string = kSwitchPrefixes[0] + combined_switch_string;
[email protected]06cc083a2011-03-01 02:28:42315 if (!value.empty())
316 combined_switch_string += kSwitchValueSeparator + value;
[email protected]a40ca4302011-05-14 01:10:24317 // Append the switch and update the switches/arguments divider |begin_args_|.
318 argv_.insert(argv_.begin() + begin_args_++, combined_switch_string);
[email protected]06cc083a2011-03-01 02:28:42319}
320
321void CommandLine::AppendSwitchASCII(const std::string& switch_string,
322 const std::string& value_string) {
323#if defined(OS_WIN)
thestig8badc792014-12-04 22:14:22324 AppendSwitchNative(switch_string, ASCIIToUTF16(value_string));
[email protected]06cc083a2011-03-01 02:28:42325#elif defined(OS_POSIX)
326 AppendSwitchNative(switch_string, value_string);
327#endif
328}
329
[email protected]06cc083a2011-03-01 02:28:42330void CommandLine::CopySwitchesFrom(const CommandLine& source,
331 const char* const switches[],
332 size_t count) {
333 for (size_t i = 0; i < count; ++i) {
[email protected]a40ca4302011-05-14 01:10:24334 if (source.HasSwitch(switches[i]))
335 AppendSwitchNative(switches[i], source.GetSwitchValueNative(switches[i]));
[email protected]06cc083a2011-03-01 02:28:42336 }
337}
338
[email protected]75f1c782011-07-13 23:41:22339CommandLine::StringVector CommandLine::GetArgs() const {
[email protected]a40ca4302011-05-14 01:10:24340 // Gather all arguments after the last switch (may include kSwitchTerminator).
341 StringVector args(argv_.begin() + begin_args_, argv_.end());
342 // Erase only the first kSwitchTerminator (maybe "--" is a legitimate page?)
343 StringVector::iterator switch_terminator =
344 std::find(args.begin(), args.end(), kSwitchTerminator);
345 if (switch_terminator != args.end())
346 args.erase(switch_terminator);
347 return args;
348}
349
[email protected]06cc083a2011-03-01 02:28:42350void CommandLine::AppendArg(const std::string& value) {
351#if defined(OS_WIN)
[email protected]bd6fc2f2014-03-17 23:55:43352 DCHECK(IsStringUTF8(value));
353 AppendArgNative(UTF8ToWide(value));
[email protected]06cc083a2011-03-01 02:28:42354#elif defined(OS_POSIX)
355 AppendArgNative(value);
356#endif
357}
358
359void CommandLine::AppendArgPath(const FilePath& path) {
360 AppendArgNative(path.value());
361}
362
363void CommandLine::AppendArgNative(const CommandLine::StringType& value) {
[email protected]06cc083a2011-03-01 02:28:42364 argv_.push_back(value);
[email protected]06cc083a2011-03-01 02:28:42365}
366
367void CommandLine::AppendArguments(const CommandLine& other,
368 bool include_program) {
[email protected]06cc083a2011-03-01 02:28:42369 if (include_program)
[email protected]a40ca4302011-05-14 01:10:24370 SetProgram(other.GetProgram());
thestig8badc792014-12-04 22:14:22371 AppendSwitchesAndArguments(this, other.argv());
[email protected]06cc083a2011-03-01 02:28:42372}
373
374void CommandLine::PrependWrapper(const CommandLine::StringType& wrapper) {
[email protected]06cc083a2011-03-01 02:28:42375 if (wrapper.empty())
376 return;
[email protected]a40ca4302011-05-14 01:10:24377 // The wrapper may have embedded arguments (like "gdb --args"). In this case,
378 // we don't pretend to do anything fancy, we just split on spaces.
379 StringVector wrapper_argv;
[email protected]2f3b1cc2014-03-17 23:07:15380 SplitString(wrapper, FILE_PATH_LITERAL(' '), &wrapper_argv);
[email protected]a40ca4302011-05-14 01:10:24381 // Prepend the wrapper and update the switches/arguments |begin_args_|.
382 argv_.insert(argv_.begin(), wrapper_argv.begin(), wrapper_argv.end());
383 begin_args_ += wrapper_argv.size();
[email protected]06cc083a2011-03-01 02:28:42384}
385
386#if defined(OS_WIN)
thestig8badc792014-12-04 22:14:22387void CommandLine::ParseFromString(const string16& command_line) {
388 string16 command_line_string;
[email protected]2f3b1cc2014-03-17 23:07:15389 TrimWhitespace(command_line, TRIM_ALL, &command_line_string);
[email protected]a40ca4302011-05-14 01:10:24390 if (command_line_string.empty())
[email protected]bb975362009-01-21 01:00:22391 return;
392
393 int num_args = 0;
394 wchar_t** args = NULL;
[email protected]a40ca4302011-05-14 01:10:24395 args = ::CommandLineToArgvW(command_line_string.c_str(), &num_args);
[email protected]bb975362009-01-21 01:00:22396
[email protected]a42d4632011-10-26 21:48:00397 DPLOG_IF(FATAL, !args) << "CommandLineToArgvW failed on command line: "
[email protected]2f3b1cc2014-03-17 23:07:15398 << UTF16ToUTF8(command_line);
[email protected]a40ca4302011-05-14 01:10:24399 InitFromArgv(num_args, args);
400 LocalFree(args);
[email protected]bb975362009-01-21 01:00:22401}
[email protected]f3adb5c2008-08-07 20:07:32402#endif
[email protected]2f3b1cc2014-03-17 23:07:15403
mgiucac974d5102014-10-01 09:24:51404CommandLine::StringType CommandLine::GetCommandLineStringInternal(
405 bool quote_placeholders) const {
406 StringType string(argv_[0]);
407#if defined(OS_WIN)
408 string = QuoteForCommandLineToArgvW(string, quote_placeholders);
409#endif
410 StringType params(GetArgumentsStringInternal(quote_placeholders));
411 if (!params.empty()) {
412 string.append(StringType(FILE_PATH_LITERAL(" ")));
413 string.append(params);
414 }
415 return string;
416}
417
418CommandLine::StringType CommandLine::GetArgumentsStringInternal(
419 bool quote_placeholders) const {
420 StringType params;
421 // Append switches and arguments.
422 bool parse_switches = true;
423 for (size_t i = 1; i < argv_.size(); ++i) {
424 StringType arg = argv_[i];
425 StringType switch_string;
426 StringType switch_value;
427 parse_switches &= arg != kSwitchTerminator;
428 if (i > 1)
429 params.append(StringType(FILE_PATH_LITERAL(" ")));
430 if (parse_switches && IsSwitch(arg, &switch_string, &switch_value)) {
431 params.append(switch_string);
432 if (!switch_value.empty()) {
433#if defined(OS_WIN)
434 switch_value =
435 QuoteForCommandLineToArgvW(switch_value, quote_placeholders);
436#endif
437 params.append(kSwitchValueSeparator + switch_value);
438 }
thestig8badc792014-12-04 22:14:22439 } else {
mgiucac974d5102014-10-01 09:24:51440#if defined(OS_WIN)
441 arg = QuoteForCommandLineToArgvW(arg, quote_placeholders);
442#endif
443 params.append(arg);
444 }
445 }
446 return params;
447}
448
[email protected]2f3b1cc2014-03-17 23:07:15449} // namespace base