Wireshark-dev: Re: [Wireshark-dev] Use ~/Library/Preferences/ for configuration files on OS X.
From: Guy Harris <guy@xxxxxxxxxxxx>
Date: Tue, 20 Oct 2015 01:18:15 -0700
On Oct 19, 2015, at 11:36 PM, Stig Bjørlykke <stig@xxxxxxxxxxxxx> wrote:

> We have currently changed to use XDG_CONFIG_HOME/wireshark for configuration files where this is appropriate.  Should we also switch to using ~/Library/Preferences/Wireshark on OS X?

Not necessarily:

	1) users with home directories on a server might want to share configuration files between UN*Xes, including OS X;

	2) Apple say of ~/Library/Preferences:

		https://developer.apple.com/library/mac/documentation/FileManagement/Conceptual/FileSystemProgrammingGuide/MacOSXDirectories/MacOSXDirectories.html

	   "You should never create files in this directory yourself. To get or set preference values, you should always use the NSUserDefaults class or an equivalent system-provided interface."

	   which means "store your settings as a plist file", which we don't do.

We also don't store settings in the Registry on Windows.

BTW, the XDG Base Directory Specification:

	http://standards.freedesktop.org/basedir-spec/basedir-spec-latest.html

doesn't do a great job of indicating when it's appropriate to use XDG_CONFIG_HOME and when it's appropriate to use XDG_DATA_HOME.  What's the difference between a "configuration file" and a "data file"?  If you follow Monsieur Dricot:

	https://ploum.net/207-modify-your-application-to-use-xdg-folders/

"There’s a little trick : just imagine that it was deleted. What would you think as a user ?

If you would cry, running frenetically to your backup, it means that it belongs to XDG_DATA_HOME.

If you would think « Damn, I will have to reconfigure all », it belongs to $XDG_CONFIG_HOME. This includes user installed plugins even if those plugins might themselves have files in XDG_DATA_HOME. The exception I see is the usernames/passwords for external services. Those are clearly configuration stuffs but, imho, just fit better in XDG_DATA_HOME."

OK, so if you lost ~/.wireshark/preferences or ~/.config/wireshark/preferences or whatever, how much of it would you remember and thus be able to "reconfigure all"?  And what about all the UAT files?  How much of that could you afford to lose before you ended up having to dig them up from a backup?

Perhaps everything in "recent" or "recent_common" (BTW, why are there two files with "recent" in their names?) would qualify as "configuration" rather than "data" - you can probably reconfigure your columns without difficulty - but at least some protocol preferences would, I suspect, not be easily remembered, especially if you have multiple profiles.