Standard path for common application data
-
wrote on 9 Sept 2016, 14:18 last edited by
Does Qt provide a way to find the location for common application data?
QStandardPaths enum includes AppConfigLocation. However, the return value on my Windows 10 machine is C:/Users/<UserName>/AppData/Local/<Organization>/Application/. This is a user-specific location. How do I write my application so it can share data files between users? BTW, I use Qt 5.6 -
Lifetime Qt Championwrote on 9 Sept 2016, 14:46 last edited by SGaist 9 Sept 2016, 14:47
Hi,
Yes it does: QStandardPathsSorry, misread your question. What kind of file do you intend to share between users ?
-
Might be the
C:\Users\Public
folder that you want to use ? -
wrote on 9 Sept 2016, 14:58 last edited by
It is a data file we make at "the factory". It controls the application behavior. Essentially "the factory" wants to configure an application for all users. When a new version is shipped and installed such configuration file may change. On Windows 7-10 such files are typically prescribed to be placed in C:\ProgramData.
C;\Users\Public is not really appealing because we would rather keep configuration files not readily exposed to end users. Nonetheless, I will look into this option.
-
Should that file be changed by other means ?
-
wrote on 9 Sept 2016, 15:29 last edited by
Can you use QSettings for this data? If so, check out the scope settings of QSettings. The Platform specific notes section describes where the data will be stored depending on what format you've chosen.
-
Can you use QSettings for this data? If so, check out the scope settings of QSettings. The Platform specific notes section describes where the data will be stored depending on what format you've chosen.
wrote on 9 Sept 2016, 16:29 last edited by@mchinand When the format is set to IniFormat and scope is set to SystemScope QSettings behaviour is exactly what I was looking for. I will be able to use it. Thanks.
On the other hand, this inquiry discovered two Qt blemishes
- QStandardPaths does not provide access to the IniFormat/SystemScope directory
- Platform specific notes of QSettings documentation is outdated. It mentions %COMMON_APPDATA% which no longer exists on Windows 10 (maybe even earlier).
-
@mchinand When the format is set to IniFormat and scope is set to SystemScope QSettings behaviour is exactly what I was looking for. I will be able to use it. Thanks.
On the other hand, this inquiry discovered two Qt blemishes
- QStandardPaths does not provide access to the IniFormat/SystemScope directory
- Platform specific notes of QSettings documentation is outdated. It mentions %COMMON_APPDATA% which no longer exists on Windows 10 (maybe even earlier).
@L_Raiz said in Standard path for common application data:
Platform specific notes of QSettings documentation is outdated. It mentions %COMMON_APPDATA% which no longer exists on Windows 10 (maybe even earlier).
The variable is valid for Windows 7 (probably 8 as well), so there's no fault here.
-
@L_Raiz said in Standard path for common application data:
Platform specific notes of QSettings documentation is outdated. It mentions %COMMON_APPDATA% which no longer exists on Windows 10 (maybe even earlier).
The variable is valid for Windows 7 (probably 8 as well), so there's no fault here.
wrote on 9 Sept 2016, 18:08 last edited by@kshegunov I just tried pointing Windows Explorer to %COMMON_APPDATA% on Windows 7 computer and received an error dialog!(
Looks to me like something is wrong with your statement.
-
@kshegunov I just tried pointing Windows Explorer to %COMMON_APPDATA% on Windows 7 computer and received an error dialog!(
Looks to me like something is wrong with your statement.
@L_Raiz
It is possible, I haven't double-checked as I currently don't have a windows at hand.
8/10