| OLD | NEW |
| 1 // Copyright (c) 2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2008 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 // This command-line program dumps the contents of a set of cache files, either | 5 // This command-line program dumps the contents of a set of cache files, either |
| 6 // to stdout or to another set of cache files. | 6 // to stdout or to another set of cache files. |
| 7 | 7 |
| 8 #include <stdio.h> | 8 #include <stdio.h> |
| 9 #include <string> | 9 #include <string> |
| 10 | 10 |
| (...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 83 bool do_convert_to_text = command_line.HasSwitch(kDumpToFiles); | 83 bool do_convert_to_text = command_line.HasSwitch(kDumpToFiles); |
| 84 | 84 |
| 85 std::wstring new_program; | 85 std::wstring new_program; |
| 86 if (do_upgrade) | 86 if (do_upgrade) |
| 87 new_program = StringPrintf(L"%ls%d.exe", L"dump_cache_", version); | 87 new_program = StringPrintf(L"%ls%d.exe", L"dump_cache_", version); |
| 88 else | 88 else |
| 89 new_program = StringPrintf(L"dump_cache.exe"); | 89 new_program = StringPrintf(L"dump_cache.exe"); |
| 90 | 90 |
| 91 hacked_command_line.insert(to_remove, new_program); | 91 hacked_command_line.insert(to_remove, new_program); |
| 92 | 92 |
| 93 CommandLine new_command_line(L""); | 93 CommandLine new_command_line = CommandLine::FromString(hacked_command_line); |
| 94 new_command_line.ParseFromString(hacked_command_line); | |
| 95 | 94 |
| 96 if (do_upgrade || do_convert_to_text) | 95 if (do_upgrade || do_convert_to_text) |
| 97 new_command_line.AppendSwitch(kSlave); | 96 new_command_line.AppendSwitch(kSlave); |
| 98 | 97 |
| 99 new_command_line.AppendSwitchWithValue(kPipe, pipe_number); | 98 new_command_line.AppendSwitchWithValue(kPipe, pipe_number); |
| 100 if (!base::LaunchApp(new_command_line, false, false, NULL)) { | 99 if (!base::LaunchApp(new_command_line, false, false, NULL)) { |
| 101 printf("Unable to launch the needed version of this tool: %ls\n", | 100 printf("Unable to launch the needed version of this tool: %ls\n", |
| 102 new_program.c_str()); | 101 new_program.c_str()); |
| 103 printf(kUpgradeHelp); | 102 printf(kUpgradeHelp); |
| 104 return TOOL_NOT_FOUND; | 103 return TOOL_NOT_FOUND; |
| (...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 172 Sleep(500); | 171 Sleep(500); |
| 173 return ALL_GOOD; | 172 return ALL_GOOD; |
| 174 } | 173 } |
| 175 | 174 |
| 176 if (command_line.HasSwitch(kDumpContents)) | 175 if (command_line.HasSwitch(kDumpContents)) |
| 177 return DumpContents(input_path); | 176 return DumpContents(input_path); |
| 178 if (command_line.HasSwitch(kDumpHeaders)) | 177 if (command_line.HasSwitch(kDumpHeaders)) |
| 179 return DumpHeaders(input_path); | 178 return DumpHeaders(input_path); |
| 180 return Help(); | 179 return Help(); |
| 181 } | 180 } |
| OLD | NEW |