summaryrefslogtreecommitdiffstats
path: root/net/tools
diff options
context:
space:
mode:
authormsw@chromium.org <msw@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-07-20 04:54:52 +0000
committermsw@chromium.org <msw@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-07-20 04:54:52 +0000
commit61a4c6f8372350bedd95d8834c8bfd1b36a27c1b (patch)
treed2c796ee2336083b018d6a38fc54627b26559498 /net/tools
parent480ac51965719719beb1761274491acb6eda95e9 (diff)
downloadchromium_src-61a4c6f8372350bedd95d8834c8bfd1b36a27c1b.zip
chromium_src-61a4c6f8372350bedd95d8834c8bfd1b36a27c1b.tar.gz
chromium_src-61a4c6f8372350bedd95d8834c8bfd1b36a27c1b.tar.bz2
Rename CommandLine::GetCommandLineString().
Fix string hackery in net/tools/dump_cache/dump_cache.cc Fix const casts in chrome/installer/util/product.cc and base/process_util_win.cc. BUG=73195 TEST=none Review URL: http://codereview.chromium.org/7386002 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@93165 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'net/tools')
-rw-r--r--net/tools/dump_cache/dump_cache.cc32
1 files changed, 11 insertions, 21 deletions
diff --git a/net/tools/dump_cache/dump_cache.cc b/net/tools/dump_cache/dump_cache.cc
index ee5a50e..59b85f8 100644
--- a/net/tools/dump_cache/dump_cache.cc
+++ b/net/tools/dump_cache/dump_cache.cc
@@ -71,35 +71,25 @@ int Help() {
}
// Starts a new process, to generate the files.
-int LaunchSlave(const CommandLine& command_line,
- const std::wstring& pipe_number, int version) {
- // TODO(port): remove this string-munging hackery.
- std::wstring hacked_command_line = command_line.command_line_string();
- const std::wstring old_exe(L"dump_cache");
- size_t to_remove = hacked_command_line.find(old_exe);
- hacked_command_line.erase(to_remove, old_exe.size());
-
+int LaunchSlave(CommandLine command_line,
+ const std::wstring& pipe_number,
+ int version) {
bool do_upgrade = command_line.HasSwitch(kUpgrade);
bool do_convert_to_text = command_line.HasSwitch(kDumpToFiles);
- std::wstring new_program;
- if (do_upgrade)
- new_program = base::StringPrintf(L"%ls%d", L"dump_cache_", version);
- else
- new_program = base::StringPrintf(L"dump_cache");
-
- hacked_command_line.insert(to_remove, new_program);
-
- CommandLine new_command_line = CommandLine::FromString(hacked_command_line);
+ if (do_upgrade) {
+ FilePath program(base::StringPrintf(L"%ls%d", L"dump_cache", version));
+ command_line.SetProgram(program);
+ }
if (do_upgrade || do_convert_to_text)
- new_command_line.AppendSwitch(kSlave);
+ command_line.AppendSwitch(kSlave);
// TODO(evanm): remove needless usage of wstring from here and elsewhere.
- new_command_line.AppendSwitchASCII(kPipe, WideToASCII(pipe_number));
- if (!base::LaunchProcess(new_command_line, base::LaunchOptions(), NULL)) {
+ command_line.AppendSwitchASCII(kPipe, WideToASCII(pipe_number));
+ if (!base::LaunchProcess(command_line, base::LaunchOptions(), NULL)) {
printf("Unable to launch the needed version of this tool: %ls\n",
- new_program.c_str());
+ command_line.GetProgram().value().c_str());
printf(kUpgradeHelp);
return TOOL_NOT_FOUND;
}