summaryrefslogtreecommitdiffstats
path: root/base/command_line.cc
diff options
context:
space:
mode:
authorthestig@chromium.org <thestig@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-10-09 20:37:56 +0000
committerthestig@chromium.org <thestig@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-10-09 20:37:56 +0000
commit8f681e432845de60b648960e4d1cec404a844581 (patch)
tree8cb6f2a9aaf2b463476a241f9e7c8ec9cdc59646 /base/command_line.cc
parent59a3b8cd0edc83cf7e0590df7665867c79694f98 (diff)
downloadchromium_src-8f681e432845de60b648960e4d1cec404a844581.zip
chromium_src-8f681e432845de60b648960e4d1cec404a844581.tar.gz
chromium_src-8f681e432845de60b648960e4d1cec404a844581.tar.bz2
Add a FilePath version of the CommandLine constructor. Mark the wstring version as deprecated.
BUG=none TEST=none Review URL: http://codereview.chromium.org/271031 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@28590 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'base/command_line.cc')
-rw-r--r--base/command_line.cc17
1 files changed, 16 insertions, 1 deletions
diff --git a/base/command_line.cc b/base/command_line.cc
index 04c1ece..0104f3b 100644
--- a/base/command_line.cc
+++ b/base/command_line.cc
@@ -14,6 +14,7 @@
#include <algorithm>
+#include "base/file_path.h"
#include "base/logging.h"
#include "base/singleton.h"
#include "base/string_piece.h"
@@ -92,6 +93,15 @@ void CommandLine::ParseFromString(const std::wstring& command_line) {
if (args)
LocalFree(args);
}
+
+CommandLine::CommandLine(const FilePath& program) {
+ if (!program.empty()) {
+ program_ = program.value();
+ command_line_string_ = L'"' + program.value() + L'"';
+ }
+}
+
+// Deprecated version
CommandLine::CommandLine(const std::wstring& program) {
if (!program.empty()) {
program_ = program;
@@ -134,6 +144,11 @@ void CommandLine::InitFromArgv() {
}
}
+CommandLine::CommandLine(const FilePath& program) {
+ argv_.push_back(program.value());
+}
+
+// Deprecated version
CommandLine::CommandLine(const std::wstring& program) {
argv_.push_back(base::SysWideToNativeMB(program));
}
@@ -275,7 +290,7 @@ std::vector<std::wstring> CommandLine::GetLooseValues() const {
return values;
}
std::wstring CommandLine::program() const {
- DCHECK(argv_.size() > 0);
+ DCHECK_GT(argv_.size(), 0U);
return base::SysNativeMBToWide(argv_[0]);
}
#endif