Fix errors when running updates in a directory requiring elevation

isWritable() is not a reliable way to check for permissions on Windows.
Instead, just try to create a file.

The alternative would be to set the magic qt_ntfs_permission_lookup
variable to 1. Anyhow, this might slow down things and cause other
regressions ...

Task-number: QTIFW-746
Change-Id: I1b5637670bfcfe29966f0545ce2c6b1f663a9738
Reviewed-by: Iikka Eklund <iikka.eklund@theqtcompany.com>
Reviewed-by: Karsten Heimrich <karsten.heimrich@theqtcompany.com>
This commit is contained in:
Kai Koehne 2015-08-19 13:34:00 +02:00
parent 85ce2334cf
commit a81f192957
2 changed files with 2 additions and 2 deletions

View File

@ -4,6 +4,7 @@
- Fix handling of system proxy with credentials. (QTBUG-46547)
- Unify selection of language for translations. (QTIFW-390)
- Fix return value of component.installAction() when updating. (QTIFW-727)
- Fix errors when updating an installation requiring elevation on Windows. (QTIFW-746)
- Documentation updates.
2.0.1

View File

@ -1604,9 +1604,8 @@ bool PackageManagerCorePrivate::runPackageUpdater()
//to have some progress for the cleanup/write component.xml step
ProgressCoordinator::instance()->addReservePercentagePoints(1);
const QString packagesXml = componentsXmlPath();
// check if we need admin rights and ask before the action happens
if (!QFileInfo(installerBinaryPath()).isWritable() || !QFileInfo(packagesXml).isWritable())
if (!QTemporaryFile(targetDir() + QStringLiteral("/XXXXXX")).open())
adminRightsGained = m_core->gainAdminRights();
const QList<Component *> componentsToInstall = m_core->orderedComponentsToInstall();