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. QStandardPaths and CSIDL_COMMON_APPDATA

QStandardPaths and CSIDL_COMMON_APPDATA

Scheduled Pinned Locked Moved Solved General and Desktop
5 Posts 3 Posters 814 Views 2 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.
  • PerdrixP Offline
    PerdrixP Offline
    Perdrix
    wrote on last edited by
    #1

    I'm somewhat bothered by an apparent omission from QStandardPaths

    There doesn't appear to be one that will return me the equivalent of

    SHGetFolderPath(nullptr, CSIDL_COMMON_APPDATA, nullptr, SHGFP_TYPE_CURRENT, szPath);
    

    which will return the location of the ProgramData directory which is the location where the public settings should be stored.

    The only one that is close is QStandardPaths::ConfigLocation but AFAICT, using

    QStandardPaths::writeableLocation(QStandardPaths::ConfigLocation)
    

    will typically return C:/Users/<USER>/AppData/Local which is the per user location, rather than %SystemDrive%/ProgramData.

    David

    1 Reply Last reply
    0
    • B Bonnie

      The default value (writableLocation) of ConfigLocation is "C:/Users/<USER>/AppData/Local/<APPNAME>"
      But you should be able to get "C:/ProgramData/<APPNAME>" from the strings returned from standardLocations, probably the second one.
      Or "C:/ProgramData" from the second string of standardLocations(GenericConfigLocation).

      PerdrixP Offline
      PerdrixP Offline
      Perdrix
      wrote on last edited by
      #5

      I've considered this and have decided to use the per user location ...

      Thanks folks.

      1 Reply Last reply
      0
      • SGaistS Offline
        SGaistS Offline
        SGaist
        Lifetime Qt Champion
        wrote on last edited by
        #2

        Hi,

        AFAIK, that class is mainly for user centered path. The path you describe is likely read only unless you are an admin, isn't it ?

        Interested in AI ? www.idiap.ch
        Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

        1 Reply Last reply
        0
        • PerdrixP Offline
          PerdrixP Offline
          Perdrix
          wrote on last edited by Perdrix
          #3

          No, not at all. It is very common for the permissions on the <APPNAME> sub-folders of ProgramData to be set by installation programs such that they are writeable by members of the "Users" group.

          So it is a "system wide" settings location but it is very commonly user writeable.

          I can accept that perhaps user applications should reserve the <APPNAME> sub-folders of ProgramData (%ALLUSERSPROFILE%) for "system wide" settings created by their installer, but historically that wasn't how it was typically used (right or wrong).

          I'm not totally averse to changing the code to use the "per user" location in the future, but to do so would create a non-trivial incompatibility with the earlier (non Qt) releases.

          1 Reply Last reply
          0
          • B Offline
            B Offline
            Bonnie
            wrote on last edited by Bonnie
            #4

            The default value (writableLocation) of ConfigLocation is "C:/Users/<USER>/AppData/Local/<APPNAME>"
            But you should be able to get "C:/ProgramData/<APPNAME>" from the strings returned from standardLocations, probably the second one.
            Or "C:/ProgramData" from the second string of standardLocations(GenericConfigLocation).

            PerdrixP 1 Reply Last reply
            1
            • B Bonnie

              The default value (writableLocation) of ConfigLocation is "C:/Users/<USER>/AppData/Local/<APPNAME>"
              But you should be able to get "C:/ProgramData/<APPNAME>" from the strings returned from standardLocations, probably the second one.
              Or "C:/ProgramData" from the second string of standardLocations(GenericConfigLocation).

              PerdrixP Offline
              PerdrixP Offline
              Perdrix
              wrote on last edited by
              #5

              I've considered this and have decided to use the per user location ...

              Thanks folks.

              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