Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implement XDG base directory compliance #136

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

mikejzx
Copy link

@mikejzx mikejzx commented Dec 1, 2023

Relevant issue: #96

This patch implements support for the XDG base directory specification. This will not affect existing user configurations, but instead extends fdm to allow the user to specify an fdm.conf file in their $XDG_CONFIG_HOME directory (often ~/.config). fdm now also will store it's fdm.lock lock file in $XDG_RUNTIME_DIR (e.g. /tmp/XXXX.runtime-dir.XXX) if it is set, and if not, will use the old behaviour of storing the lock file in the home directory.

The patch does not modify the behaviour of other "temporary files"--they are still stored in /tmp or under $TMPDIR like before.

Implements nicm#96

https://specifications.freedesktop.org/basedir-spec/basedir-spec-latest.html

If no configuration file is specified on the command-line,
$XDG_CONFIG_HOME/fdm.conf is now the first file checked, then
$HOME/.fdm.conf, and finally the system-wide /etc/fdm.conf.

This allows the user to specify where they would like the configuration
file to be stored.  E.g. many users like to set XDG_CONFIG_HOME to
$HOME/.config so that all their XDG-compliant programs have their
configuration files stored there rather than in their home directory (or
other arbitrary locations).
Continuation of nicm#96 implementation.

From https://specifications.freedesktop.org/basedir-spec/basedir-spec-latest.html:

> There is a single base directory relative to which user-specific
> runtime files and other file objects should be placed.  This directory
> is defined by the environment variable $XDG_RUNTIME_DIR.

This also may provide slight performance benefits to this as
XDG_RUNTIME_DIR is often set to a directory under /tmp which some
systems configure to be mounted as tmpfs.

If XDG_RUNTIME_DIR is not set or is an empty string, the old behaviour
of the user's home directory is used.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant