Chromium Code Reviews| Index: base/command_line.cc |
| =================================================================== |
| --- base/command_line.cc (revision 66131) |
| +++ base/command_line.cc (working copy) |
| @@ -46,6 +46,17 @@ |
| const char kSwitchValueSeparator[] = "="; |
| #endif |
| +namespace { |
| + |
| +// Trims the quotes from the beginning and end of a path. |
| +CommandLine::StringType TrimQuotes(const FilePath::StringType& path) { |
| + if (!path.empty() && path[0] == '"' && path[path.length() - 1] == '"') |
| + return path.substr(1, path.length() - 2); |
| + return path; |
| +} |
| + |
| +} // end namespace |
| + |
| #if defined(OS_WIN) |
| // Lowercase a string. This is used to lowercase switch names. |
| // Is this what we really want? It seems crazy to me. I've left it in |
| @@ -114,9 +125,9 @@ |
| CommandLine::CommandLine(const FilePath& program) { |
| if (!program.empty()) { |
| - program_ = program.value(); |
| + program_ = TrimQuotes(program.value()); |
|
Evan Martin
2010/11/15 21:01:08
I think this is wrong. A FilePath is a platonic i
|
| // TODO(evanm): proper quoting here. |
| - command_line_string_ = L'"' + program.value() + L'"'; |
| + command_line_string_ = L'"' + program_ + L'"'; |
| } |
| } |
| @@ -167,7 +178,7 @@ |
| } |
| CommandLine::CommandLine(const FilePath& program) { |
| - argv_.push_back(program.value()); |
| + argv_.push_back(TrimQuotes(program.value()); |
| } |
| #endif |