OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 file provides a command-line interface to | 5 // This file provides a command-line interface to |
6 // upgrade_test::GenerateAlternateVersion(). | 6 // upgrade_test::GenerateAlternateVersion(). |
7 | 7 |
8 #include <cstdio> | 8 #include <cstdio> |
9 #include <cstdlib> | 9 #include <cstdlib> |
10 | 10 |
(...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
133 DumpUsage(*cmd_line, errors::SHOW_HELP, std::wstring()); | 133 DumpUsage(*cmd_line, errors::SHOW_HELP, std::wstring()); |
134 return EXIT_SUCCESS; | 134 return EXIT_SUCCESS; |
135 } | 135 } |
136 | 136 |
137 base::FilePath mini_installer; | 137 base::FilePath mini_installer; |
138 if (!GetMiniInstallerPath(*cmd_line, &mini_installer)) { | 138 if (!GetMiniInstallerPath(*cmd_line, &mini_installer)) { |
139 DumpUsage(*cmd_line, errors::MINI_INSTALLER_NOT_FOUND, std::wstring()); | 139 DumpUsage(*cmd_line, errors::MINI_INSTALLER_NOT_FOUND, std::wstring()); |
140 return EXIT_FAILURE; | 140 return EXIT_FAILURE; |
141 } | 141 } |
142 | 142 |
143 if (!file_util::PathExists(mini_installer)) { | 143 if (!base::PathExists(mini_installer)) { |
144 DumpUsage(*cmd_line, errors::MINI_INSTALLER_NOT_FOUND, | 144 DumpUsage(*cmd_line, errors::MINI_INSTALLER_NOT_FOUND, |
145 mini_installer.value()); | 145 mini_installer.value()); |
146 return EXIT_FAILURE; | 146 return EXIT_FAILURE; |
147 } | 147 } |
148 | 148 |
149 base::FilePath out; | 149 base::FilePath out; |
150 GetOutPath(*cmd_line, &out); | 150 GetOutPath(*cmd_line, &out); |
151 if (!cmd_line->HasSwitch(switches::kForce) && file_util::PathExists(out)) { | 151 if (!cmd_line->HasSwitch(switches::kForce) && base::PathExists(out)) { |
152 DumpUsage(*cmd_line, errors::OUT_FILE_EXISTS, out.value()); | 152 DumpUsage(*cmd_line, errors::OUT_FILE_EXISTS, out.value()); |
153 return EXIT_FAILURE; | 153 return EXIT_FAILURE; |
154 } | 154 } |
155 | 155 |
156 upgrade_test::Direction direction = GetDirection(*cmd_line); | 156 upgrade_test::Direction direction = GetDirection(*cmd_line); |
157 | 157 |
158 std::wstring original_version; | 158 std::wstring original_version; |
159 std::wstring new_version; | 159 std::wstring new_version; |
160 | 160 |
161 if (upgrade_test::GenerateAlternateVersion(mini_installer, out, direction, | 161 if (upgrade_test::GenerateAlternateVersion(mini_installer, out, direction, |
162 &original_version, &new_version)) { | 162 &original_version, &new_version)) { |
163 fwprintf(stdout, L"Generated version %s from version %s\n", | 163 fwprintf(stdout, L"Generated version %s from version %s\n", |
164 new_version.c_str(), original_version.c_str()); | 164 new_version.c_str(), original_version.c_str()); |
165 return EXIT_SUCCESS; | 165 return EXIT_SUCCESS; |
166 } | 166 } |
167 | 167 |
168 DumpUsage(*cmd_line, errors::GENERATION_FAILED, mini_installer.value()); | 168 DumpUsage(*cmd_line, errors::GENERATION_FAILED, mini_installer.value()); |
169 return EXIT_FAILURE; | 169 return EXIT_FAILURE; |
170 } | 170 } |
OLD | NEW |