Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. Get system-wide config/data location
Forum Updated to NodeBB v4.3 + New Features

Get system-wide config/data location

Scheduled Pinned Locked Moved Unsolved General and Desktop
1 Posts 1 Posters 435 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • V Offline
    V Offline
    voltron
    wrote on last edited by
    #1

    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 a QStandardPaths class, which can return both user and system-wide locations. But QStandardPaths::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 by QStandardPaths::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!

    1 Reply Last reply
    0

    • Login

    • Login or register to search.
    • First post
      Last post
    0
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search
    • Get Qt Extensions
    • Unsolved