Data Sharing for Linux and Mac OS X

On Windows, there is a standard application data location that is shared with all users on the computer (i.e., in Vista / 7, (root):\ProgramData ). I am looking for a way to get such a folder on other platforms using Qt.

  • Does Qt provide an inline method for this? ( QDesktopServices looked promising, but doesn't seem to provide this feature.)
  • If not, what are the standard locations on Linux and Mac OS X for these common applications? Is /usr/share right place? Is there a standard at all?

[ACKNOWLEDGMENT] This is for mutable data.

+6
linux qt macos
source share
3 answers

I do not know if the Qt API supports this. Here is the specific OS X information.

In OS X, this depends on whether it supports a graphical application or UNIX-level support libraries. For a GUI application, the standard practice is that all readable data is accessible to all users within the application package itself. Usually you have

  YourApp.app/ YourApp.app/Contents YourApp.app/Contents/MacOS YourApp.app/Contents/MacOS/YouApp .... this is the binary YourApp.app/Contents/Resources/ .... here are all the shared data 

The GUI is YourApp.app directory as the application itself, so you can copy / move it without any problems. If this is not possible, a subdirectory is recommended.

 /Library/Application Support/name_of_your_app/ 

for data shared by users.

It is a bad idea to have altered, shared data among users on a machine; this is generally not possible due to access restrictions. Please note that the standard user may not have, and in fact usually does not have administrative rights to write to the shared folder.

For user-specific mutable data, use

 ~/Library/Application Support/name_of_your_app/ 

See this Apple manual for more details.

+7
source share

The standard file system hierarchy suggests that /usr/share should be used for independent file-independent files and /var/lib should be used for status information related to the application or system .

You did not indicate whether you are referring to read-only mode or mutable state, but the wording of your question (in particular, comparison with %COMMONAPPDATA% ) suggests a volatile state, in which case /var/lib would be appropriate. Remember to have a group of users with write permissions in your subdirectory accessible (or created by installing the script package) and that sysadmin add the appropriate users to this group.

+2
source share

On Mac OS, one solution is to use the / Users / Shared directory, as it is read / write for all users and therefore changed for everyone. Be sure to make sure that all the files you create are readable and writable by everyone.

Or you can use application support, as suggested by others, and make any files that you need in order to be read / write mutable for everyone, but this means that the administrator must first create them either using the installer or from the first launch that a little ugly.

My company uses Users / Shared for this purpose, but I don't know how neatly it counts.

+2
source share

All Articles