Expected Config File Locations

David Cantrell david at cantrell.org.uk
Tue Aug 30 21:51:55 BST 2011


On Tue, Aug 30, 2011 at 01:55:48PM +0100, Smylers wrote:

> Hi. I'm looking for some advice on where I should put the config file
> for a command I'm distributing on Cpan. Where would you it to be? I'm
> interested in opinions of Windows, Mac, and Unix users, for both
> per-user and system-wide config.

On Mac and other Unix-a-likes, .${command}rc or .$command for per-user
config, and /etc/$command or /etc/${command}rc for system-wide config.

On Windows, I presume that it should be in the registry, but Microsoft
may have changed things in the decade since I last had to care.

> * Most Windows systems seem to be single-user; do I even need both
>   system-wide and per-user locations on Windows, and if not which one
>   would you expect to find?

Depends on what the program is.  There are plenty of Windows machines
that have multiple users, even if they can't all be logged in at the
same time.

> And on Unix:
> 
> * system_cfg_dir always returns /etc/. On some Unices such as FreeBSD
>   I've seen /usr/local/etc/ used for commands that are installed under
>   /usr/local/. Is that what you'd expect?

I've come to expect it, but I prefer /etc.

>   File::ConfigDir has local_cfg_dir, which returns /usr/local/etc. So I
>   could use that if the command has been installed in /usr/local/bin/
>   and stick with /etc/ otherwise.
>   
>   But I'd be surprised to find /usr/local/etc/ being used on Linux.

I wouldn't.  Something that does that on FreeBSD is pretty likely to
also do it on Linux, I would have thought.

-- 
David Cantrell | Nth greatest programmer in the world

    I caught myself pulling grey hairs out of my beard.
    I'm definitely not going grey, but I am going vain.


More information about the london.pm mailing list