Standards-specified location for user configuration files

configurationdirectory-structurehome

I'm talking about files like ~/.foo found on a user's home dir. I'm working on a program that reads from such a file, and I'd also like to clean up my user root directory if I can.

Is there a POSIX-specified variable, such as ~/$(conf) where config like .emacs can be found?

Best Answer

POSIX

Searching through the specification for the strings "user config" or "configuration files" turned up zero hits, so I would say no it doesn't specify this in any way.

FHS

Looking at the FHS - Filesystem Hierarchy Standard it had this bit:

User specific configuration files for applications are stored in the user's home directory in a file that starts with the '.' character (a "dot file"). If an application needs to create more than one dot file then they should be placed in a subdirectory with a name starting with a '.' character, (a "dot directory"). In this case the configuration files should not start with the '.' character. 11.

sysconf/getconf

Looking through the list of POSIX configuration constants present in <limits.h> is the only other place I can think of where something like this would be configured. Running the command getconf <var> will return these types of results.

For example:

$ getconf _POSIX_CHILD_MAX
1024

But looking through the list of definitions I don't see any pertaining to a user's home directory.

Related Question