Where store data?

I have some data and I want to write it. I'm on Windows, but I want it to Linux, too.
In Windows, I'm used to use "%APPDATA%". There is one better way?
You just store it wherever. Even in Windows you don't have to use appdata.
closed account (3hM2Nwbp)
The answer to this is dependent on a lot of things.

1) What's the data used for?
2) What's your installation strategy?
3) Should the data be transparent to the user?
4) What are your security constraints?
Some general guidelines.

Unix essential dirs http://en.wikipedia.org/wiki/Filesystem_Hierarchy_Standard
More application-related http://standards.freedesktop.org/basedir-spec/basedir-spec-latest.html

Some packages also use /home/user/.program/ to store whatever (but I hate them for polluting my home).
I also find it cleaner to just use /etc/ for global configuration instead of /etc/xdg/. A lot of programs do this anyway.
Last edited on
On Windows, store it in either the registry or in the user's AppData directory.

On *nix, store it in a hidden file or subdirectory of the user's home directory.

Standard places.
> On *nix, store it in a hidden file or subdirectory of the user's home directory.
Please don't.
Refer to maeriden link http://standards.freedesktop.org/basedir-spec/basedir-spec-latest.html
My program is run-able. I wish to use the same directory, but th user cant change it.
Last edited on
My program is run-able.
Does this mean it's a desktop application?

I wish to use the same directory, but th user cant change it.
The same directory of what for what?
To make the user unable to change it, the simplest way is to just hardcode the path in the executable.
Run-able: no install.
That shouldn't make a difference.
You're not being very clear. If the standard directories aren't good for you tell us what you need, and maybe we can help.
Duoas wrote:
On *nix, store it in a hidden file or subdirectory of the user's home directory.
ne555 wrote:

Please don't.
Refer to maeriden link http://standards.freedesktop.org/basedir-spec/basedir-spec-latest.html

I know what the link says, but fact is that Duoas's method is the norm for *nix. Most programs end up doing a hidden directory in the home folder, here is a screenshot from my home folder after making hidden files visible. Wine, Codeblocks, Desura, and many more do that.
The link is a nice one, but it does say, basically, 'try these $FOO directory variables first, and failing that, use the home folder in a prescribed way'.

I didn't know about the link. How likely is it that other nixen will tolerate or use the Free Desktop specs?
Topic archived. No new replies allowed.