Where store data?

Feb 17, 2014 at 8:52pm
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?
Feb 17, 2014 at 10:41pm
You just store it wherever. Even in Windows you don't have to use appdata.
Feb 18, 2014 at 1:29am
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?
Feb 18, 2014 at 2:21am
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 Feb 18, 2014 at 2:22am
Feb 18, 2014 at 2:24am
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.
Feb 18, 2014 at 5:20am
> 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
Feb 18, 2014 at 8:43am
My program is run-able. I wish to use the same directory, but th user cant change it.
Last edited on Feb 18, 2014 at 8:44am
Feb 18, 2014 at 5:15pm
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.
Feb 20, 2014 at 8:13am
Run-able: no install.
Feb 20, 2014 at 10:19am
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.
Feb 20, 2014 at 7:44pm
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.
Feb 21, 2014 at 12:26am
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.