[PATCH 4 of 4] Use native path to execute software update on windows

Wald Commits scm-commit at wald.intevation.org
Thu May 22 10:52:17 CEST 2014


# HG changeset patch
# User Andre Heinecke <aheinecke at intevation.de>
# Date 1400748730 0
# Node ID 4cc378f335f5f8f5bedcd07bc36f18f7b4ee3e4d
# Parent  d512d8eef8f63041269165bb863888560f43ba0d
Use native path to execute software update on windows

    This still does not work and always returns access denied on execution

diff -r d512d8eef8f6 -r 4cc378f335f5 ui/mainwindow.cpp
--- a/ui/mainwindow.cpp	Thu May 22 08:51:12 2014 +0000
+++ b/ui/mainwindow.cpp	Thu May 22 08:52:10 2014 +0000
@@ -183,7 +183,7 @@
 }
 
 void MainWindow::handleNewSW(const QString& fileName, const QDateTime& modDate) {
-    mCurMessage = tr("<h3>An update for %1 is available.</h3>\n"
+    mCurMessage = tr("An update for %1 is available.\n"
             "Click here to download and install the update.").arg(
                 QApplication::applicationName());
     setState(NewSoftwareAvailable);
@@ -203,7 +203,8 @@
     }
 #ifdef WIN32
     SHELLEXECUTEINFOW shExecInfo;
-    shExecInfo.lpFile = reinterpret_cast<LPCWSTR> (fileName.utf16());
+    shExecInfo.lpFile = reinterpret_cast<LPCWSTR> (
+            QDir::toNativeSeparators(instProcInfo.absoluteFilePath()).utf16());
 
     if (!is_admin()) {
         shExecInfo.lpVerb = L"open";
@@ -211,7 +212,8 @@
         shExecInfo.lpVerb = L"runas";
     }
 
-    qDebug() << "Starting process " << fileName;
+    qDebug() << "Admin? " << is_admin();
+    qDebug() << "Starting processs: " << QDir::toNativeSeparators(instProcInfo.absoluteFilePath());
 
     if (!ShellExecuteExW(&shExecInfo)) {
         /* Execution failed, maybe the user aborted the UAC check? */


More information about the Trustbridge-commits mailing list