Program data locations
-
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
-
use "QStandardPaths::writableLocation()":http://qt-project.org/doc/qt-5.0/qtcore/qstandardpaths.html#writableLocation instead.
-
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? -
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.