diff options
author | Arttu Tarkiainen <arttu.tarkiainen@qt.io> | 2021-01-05 15:58:14 +0200 |
---|---|---|
committer | Arttu Tarkiainen <arttu.tarkiainen@qt.io> | 2021-01-15 09:27:29 +0200 |
commit | 57078aec62049ac08c5df94db06c79e956fd0eeb (patch) | |
tree | c5b2801f47e03d3b94a714440249a779d9e87637 /tests/auto/installer/createdesktopentryoperation/tst_createdesktopentryoperation.cpp | |
parent | 20f354b38b83e4aab107b388fe3c5e2ccd878946 (diff) |
Fix InstallIcons and CreateDesktopEntry operations usage as root
The operations write the output files to a valid, writable directory
value of XDG_DATA_HOME variable if set, otherwise defaulting to
"$HOME/.local/share". This follows the XDG Base Directory Specification
but misses the use case of system-wide installation: the XDG_DATA_HOME
should only contain base directory relative to which user specific data
files should be stored.
Prefer a predefined value "/usr/local/share" when launced as root or
the internal elevated admin rights handling is active. This should be
a sane and well known value for applications installed system-wide, and
should not conflict with files extracted by distribution's package
management system.
Task-number: QTIFW-2093
Change-Id: I96fab3367122e7df783697e07baeb71dfd9b3f0e
Reviewed-by: Leena Miettinen <riitta-leena.miettinen@qt.io>
Reviewed-by: Katja Marttila <katja.marttila@qt.io>
Diffstat (limited to 'tests/auto/installer/createdesktopentryoperation/tst_createdesktopentryoperation.cpp')
-rw-r--r-- | tests/auto/installer/createdesktopentryoperation/tst_createdesktopentryoperation.cpp | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/tests/auto/installer/createdesktopentryoperation/tst_createdesktopentryoperation.cpp b/tests/auto/installer/createdesktopentryoperation/tst_createdesktopentryoperation.cpp index ac3fffbe1..32e23ea14 100644 --- a/tests/auto/installer/createdesktopentryoperation/tst_createdesktopentryoperation.cpp +++ b/tests/auto/installer/createdesktopentryoperation/tst_createdesktopentryoperation.cpp @@ -73,6 +73,8 @@ private: .split(QLatin1Char(':'), QString::SkipEmptyParts); // Default path if XDG_DATA_HOME is not set directories.append(QDir::home().absoluteFilePath(QLatin1String(".local/share"))); + // Default path if run as root + directories.append(QLatin1String("/usr/local/share")); bool validPath = false; foreach (const QString &dir, directories) { // Desktop entry should be in one of the expected locations |