diff options
author | evan@chromium.org <evan@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-08-13 22:10:30 +0000 |
---|---|---|
committer | evan@chromium.org <evan@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-08-13 22:10:30 +0000 |
commit | 0445eb4ed9f9a9bb86f8c4338f86a84fbce7b7f2 (patch) | |
tree | 63eb34b491bfec6af9a6c04361d21d86c086d7eb /base/command_line.cc | |
parent | c2c263cd9f2ac658d6dc35ecbd4551ca0c5cb154 (diff) | |
download | chromium_src-0445eb4ed9f9a9bb86f8c4338f86a84fbce7b7f2.zip chromium_src-0445eb4ed9f9a9bb86f8c4338f86a84fbce7b7f2.tar.gz chromium_src-0445eb4ed9f9a9bb86f8c4338f86a84fbce7b7f2.tar.bz2 |
CommandLine: eliminate wstring-accepting AppendLooseValue
Instead use AppendArg variants which accept a FilePath or an ASCII string.
Review URL: http://codereview.chromium.org/3134008
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@56100 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'base/command_line.cc')
-rw-r--r-- | base/command_line.cc | 24 |
1 files changed, 18 insertions, 6 deletions
diff --git a/base/command_line.cc b/base/command_line.cc index 5767669..9b531fa 100644 --- a/base/command_line.cc +++ b/base/command_line.cc @@ -422,11 +422,14 @@ void CommandLine::AppendSwitchNative(const std::string& switch_string, switches_[switch_string] = value; } -void CommandLine::AppendLooseValue(const std::wstring& value) { - // TODO(evan): the quoting here is wrong, but current callers rely on it - // being wrong. I have another branch which fixes all the callers. +void CommandLine::AppendArg(const std::string& value) { + DCHECK(IsStringUTF8(value)); + AppendArgNative(UTF8ToWide(value)); +} + +void CommandLine::AppendArgNative(const std::wstring& value) { command_line_string_.append(L" "); - command_line_string_.append(value); + command_line_string_.append(WindowsStyleQuote(value)); args_.push_back(value); } @@ -472,8 +475,13 @@ void CommandLine::AppendSwitchASCII(const std::string& switch_string, AppendSwitchNative(switch_string, value_string); } -void CommandLine::AppendLooseValue(const std::wstring& value) { - argv_.push_back(base::SysWideToNativeMB(value)); +void CommandLine::AppendArg(const std::string& value) { + AppendArgNative(value); +} + +void CommandLine::AppendArgNative(const std::string& value) { + DCHECK(IsStringUTF8(value)); + argv_.push_back(value); } void CommandLine::AppendArguments(const CommandLine& other, @@ -499,6 +507,10 @@ void CommandLine::PrependWrapper(const std::string& wrapper) { #endif +void CommandLine::AppendArgPath(const FilePath& path) { + AppendArgNative(path.value()); +} + void CommandLine::AppendSwitchPath(const std::string& switch_string, const FilePath& path) { AppendSwitchNative(switch_string, path.value()); |