Qt Forum

    • Login
    • Search
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search
    • Unsolved

    Program data locations

    General and Desktop
    4
    8
    4866
    Loading More Posts
    • 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.
    • G
      GrahamL last edited by

      Hi
      I am developing a desktop application and need to find somewhere to store persistent data. This data needs to be shared with all users of the pc upon which the application is stored.
      I have looked at QStandardPaths and the DataLocation, but when I use
      @
      QStringList sl = QStandardPaths::standardLocations(QStandardPaths::DataLocation);
      @
      I get 2 paths one to the users AppData/Local folder with the organisation and application names appended and one to C:/ProgramData (again with the names appended)

      Now I know that I need to user the second one,

      but am I guaranteed that the this will always be in the second position

      will it work cross platform?

      is there a better way

      Thanks for you time

      1 Reply Last reply Reply Quote 0
      • raven-worx
        raven-worx Moderators last edited by

        use "QStandardPaths::writableLocation()":http://qt-project.org/doc/qt-5.0/qtcore/qstandardpaths.html#writableLocation instead.

        --- SUPPORT REQUESTS VIA CHAT WILL BE IGNORED ---
        If you have a question please use the forum so others can benefit from the solution in the future

        1 Reply Last reply Reply Quote 0
        • G
          GrahamL last edited by

          Hi
          I did that and passed GenericDataLocation
          This returned a path for the current user , whereas I need a location accessible by ALL users

          1 Reply Last reply Reply Quote 0
          • raven-worx
            raven-worx Moderators last edited by

            hmmm...seems that all "QStandardPaths::StandardLocation enum":http://qt-project.org/doc/qt-5.0/qtcore/qstandardpaths.html#StandardLocation-enum values are user specific then...
            What does QStandardPaths::RuntimeLocation return?

            --- SUPPORT REQUESTS VIA CHAT WILL BE IGNORED ---
            If you have a question please use the forum so others can benefit from the solution in the future

            1 Reply Last reply Reply Quote 0
            • G
              GrahamL last edited by

              returns C:/Users/Graham.Labdon

              1 Reply Last reply Reply Quote 0
              • T
                tobias.hunger last edited by

                Putting data into a path that is writable for all users is a security risk as every user of the machine can go ahead and corrupt your data for you. That is why there is no such location available.

                I recommend running a service to manage the data and the access to it (which can then store into the user location) and having client UI applications interact with that service.

                1 Reply Last reply Reply Quote 0
                • G
                  GrahamL last edited by

                  Thanks Tobias

                  What is meant by a 'service' ?

                  1 Reply Last reply Reply Quote 0
                  • D
                    dfaure last edited by

                    "guaranteed to be in second position" - not necessarily, there could be more, but the order is always "most local" to "most global". So using .last() is the best way to get the most global directory.

                    David Faure (david.faure@kdab.com)
                    KDE/Qt Senior Software Engineer
                    KDAB - Qt Experts - Platform-independent software solutions

                    1 Reply Last reply Reply Quote 0
                    • First post
                      Last post