Unsolved Get system-wide config/data location
-
Is it possible to get system-wide location of the config/data directory for any user with Qt? Something like
C:\Users\AllUsers\AppData
in Windows and/usr/local/share
in Linux etc.I checked Qt4 docs, seems
QDesktopServices
is the right class to use, but it returns only user folder not system-wide location. In Qt5 there is aQStandardPaths
class, which can return both user and system-wide locations. ButQStandardPaths::standardLocations(QStandardPaths::AppDataLocation)
returns list of paths and I can't extract required path from this list, as there is no warranty that order of items in it always will be the same. Also from what I understand, result returned byQStandardPaths::locate(QStandardPaths::AppDataLocation, fileName)
depends on the user who runs program, e.f. for ordinal user it will return user directory like/home/user/.local/share/someprog
, for sysadmin/usr/local/share/someprog
.Any ideas how to get system-wide config/data directory in crossplatform way?
Thanks!