[PATCH 1 of 4] Add installation parameters with correct quoting
Wald Commits
scm-commit at wald.intevation.org
Wed May 28 13:01:11 CEST 2014
# HG changeset patch
# User Andre Heinecke <aheinecke at intevation.de>
# Date 1401267353 0
# Node ID c944de9900de9eb71f28ad68ceece9168ed5fdf3
# Parent d0e7a80a11fe1d82579e7f135cdb18f2222fb5b1
Add installation parameters with correct quoting
diff -r d0e7a80a11fe -r c944de9900de ui/mainwindow.cpp
--- a/ui/mainwindow.cpp Wed May 28 12:16:36 2014 +0200
+++ b/ui/mainwindow.cpp Wed May 28 08:55:53 2014 +0000
@@ -244,13 +244,18 @@
QDir installDir = fi.absoluteDir();
#ifdef WIN32
+ QString parameters = QString::fromLatin1("/S /UPDATE=1 /D=") +
+ installDir.path().replace("/", "\\") + "";
+
SHELLEXECUTEINFOW shExecInfo;
memset (&shExecInfo, 0, sizeof(SHELLEXECUTEINFOW));
shExecInfo.cbSize = sizeof(SHELLEXECUTEINFOW);
shExecInfo.lpFile = reinterpret_cast<LPCWSTR> (filePath.utf16());
+ shExecInfo.lpParameters = reinterpret_cast<LPCWSTR> (parameters.utf16());
- shExecInfo.fMask = SEE_MASK_NOASYNC;
+ // shExecInfo.fMask = SEE_MASK_NOASYNC;
+ shExecInfo.nShow = SW_SHOWDEFAULT;
if (!is_admin()) {
shExecInfo.lpVerb = L"open";
@@ -258,7 +263,8 @@
shExecInfo.lpVerb = L"runas";
}
- qDebug() << "Starting process: " << filePath;
+ qDebug() << "Starting process: " << filePath
+ << " with arguments: " << parameters;
if (!ShellExecuteExW(&shExecInfo)) {
/* Execution failed, maybe the user aborted the UAC check? */
@@ -270,9 +276,13 @@
return;
}
#else /* WIN32 */
- qDebug() << "Starting process " << filePath;
+ QStringList parameters;
+ parameters << "/S" << "/UPDATE=1"
+ << QString::fromLatin1("/D=%1").arg(installDir.path());
- if (!QProcess::startDetached(filePath)) {
+ qDebug() << "Starting process " << filePath << " args: " << parameters;
+
+ if (!QProcess::startDetached(filePath, parameters)) {
qDebug() << "Failed to start process.";
return;
}
diff -r d0e7a80a11fe -r c944de9900de ui/mainwindow.h
--- a/ui/mainwindow.h Wed May 28 12:16:36 2014 +0200
+++ b/ui/mainwindow.h Wed May 28 08:55:53 2014 +0000
@@ -136,7 +136,7 @@
private:
/** @brief check the integrity of available certificate lists.
*
- * Note: Do not use this as a trust check as this only works on
+ * Note: Do not use this as a local trust check as this only works on
* FileNames where the underlying files can change. This
* is just meant to check if the downloaded data was somehow
* removed or corrupted. It also initializes mListToInstall
@@ -146,7 +146,7 @@
/** @brief check the integrity of available software updates.
*
- * Note: Do not use this as a trust check as this only works on
+ * Note: Do not use this as a local trust check as this only works on
* FileNames where the underlying files can change. This
* is just meant to check if the downloaded data was somehow
* removed or corrupted.
More information about the Trustbridge-commits
mailing list