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

XDG User Config File Fixes #110

Merged

Conversation

@0cjs
Copy link
Contributor

@0cjs 0cjs commented Apr 1, 2020

LoadAllConfigurations() was not loading the XDG user config file (default $HOME/.config/linapple/linapple.conf) and, worse yet, wiping out the contents of that default path (whether or not it was the actual XDG user path) if no other user config file was found. This fixes both of these problems.

See the commit messages for full details. The diffs will also be much more clear if you read the diffs for each individual commit.

0cjs added 4 commits Apr 1, 2020
It's a vector of paths to files, not a directory.
…lable

While we correctly calculated the location of XDG_CONFIG_HOME (default
$HOME/.config/), we then never used it, thus the linapple/linapple.conf
underneath it would never be read.

Worse yet, later code, if had found no writable user configuration file at
all, would create ~/.config/linapple/linapple.conf, truncating it if it
already exists, thus wiping out any configuration the user had put in
there.
If no writable user configuration file is found, we create one. However,
this was incorrectly hardcoded to create linapple/linapple.conf under
$HOME/.config/; that directory is correct only if $XDG_CONFIG_HOME is not
set or is set to that value.

We have already calculated the correct location of the XDG user config dir,
so we can just re-use that value to fix this.

Also change the warning when we cannot find any of the environment
variables we needed to locate/create a user config file to make it clear
that we checked $XDG_CONFIG_HOME as well as $HOME.
Also add --conf and --help to the Readme.
@0cjs 0cjs force-pushed the 0cjs:dev/cjs/200401/xdg-config-fixes branch from 5684528 to 7bafc34 Apr 2, 2020
@0cjs
Copy link
Contributor Author

@0cjs 0cjs commented Apr 7, 2020

Are there any issues with this that are delaying a merge to master? (@maxolasersquad ?)

@maxolasersquad maxolasersquad merged commit 1a5a1bd into linappleii:master Apr 7, 2020
1 check passed
1 check passed
Travis CI - Pull Request Build Passed
Details
@0cjs 0cjs deleted the 0cjs:dev/cjs/200401/xdg-config-fixes branch Apr 7, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked issues

Successfully merging this pull request may close these issues.

None yet

2 participants