Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(3086)

Unified Diff: chrome/installer/util/install_util.cc

Issue 6526040: CommandLine refactoring and cleanup. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Major refresh after r76339 and r76419. Created 9 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: chrome/installer/util/install_util.cc
diff --git a/chrome/installer/util/install_util.cc b/chrome/installer/util/install_util.cc
index 480e5df2f4e988ff508b68c32039112864949693..aff8e3743357c9ccdf63119fc22ee187cbf4062f 100644
--- a/chrome/installer/util/install_util.cc
+++ b/chrome/installer/util/install_util.cc
@@ -359,22 +359,9 @@ int InstallUtil::GetInstallReturnCode(installer::InstallStatus status) {
void InstallUtil::MakeUninstallCommand(const std::wstring& exe_path,
const std::wstring& arguments,
CommandLine* command_line) {
- const bool no_program = exe_path.empty();
-
- // Return a bunch of nothingness.
- if (no_program && arguments.empty()) {
- *command_line = CommandLine(CommandLine::NO_PROGRAM);
- } else {
- // Form a full command line string.
- std::wstring command;
- command.append(1, L'"')
- .append(no_program ? L"" : exe_path)
- .append(L"\" ")
- .append(arguments);
-
- // If we have a program name, return this complete command line.
- *command_line = CommandLine::FromString(command);
- }
+ // Surround non-empty program name with simple quotes.
+ std::wstring program(!exe_path.empty() ? L"\"" + exe_path + L"\" " : L"\"\"");
+ *command_line = CommandLine::FromString(program + arguments);
Evan Martin 2011/05/10 23:48:32 This is a little bit terrifying to me. How certai
msw 2011/05/11 02:28:12 I agree that this isn't robust quoting/escaping, b
}
std::wstring InstallUtil::GetCurrentDate() {

Powered by Google App Engine
This is Rietveld 408576698