1
0
mirror of https://github.com/qTox/qTox.git synced 2024-03-22 14:00:36 +08:00

fix(updater): Use module path, not working dir

Fix #3255
This commit is contained in:
tux3 2016-05-09 15:39:02 +02:00
parent 7c63594adf
commit 0a2e96ab07
No known key found for this signature in database
GPG Key ID: 7E086DD661263264

View File

@ -492,11 +492,14 @@ void AutoUpdater::installLocalUpdate()
// Workaround QTBUG-7645 // Workaround QTBUG-7645
// QProcess fails silently when elevation is required instead of showing a UAC prompt on Win7/Vista // QProcess fails silently when elevation is required instead of showing a UAC prompt on Win7/Vista
#ifdef Q_OS_WIN #ifdef Q_OS_WIN
HINSTANCE result = ::ShellExecuteW(0, L"open", updaterBin.toStdWString().c_str(), 0, 0, SW_SHOWNORMAL); QString modulePath = qApp->applicationDirPath().replace('/', '\\');
HINSTANCE result = ::ShellExecuteW(0, L"open", updaterBin.toStdWString().c_str(),
0, modulePath.toStdWString().c_str(), SW_SHOWNORMAL);
if (result == (HINSTANCE)SE_ERR_ACCESSDENIED) if (result == (HINSTANCE)SE_ERR_ACCESSDENIED)
{ {
// Requesting elevation // Requesting elevation
result = ::ShellExecuteW(0, L"runas", updaterBin.toStdWString().c_str(), 0, 0, SW_SHOWNORMAL); result = ::ShellExecuteW(0, L"runas", updaterBin.toStdWString().c_str(),
0, modulePath.toStdWString().c_str(), SW_SHOWNORMAL);
} }
if (result <= (HINSTANCE)32) if (result <= (HINSTANCE)32)
failExit(); failExit();