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

Config: apply xdg system config files #4845

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

mjrochford
Copy link
Contributor

@mjrochford mjrochford commented Jan 9, 2025

fixes: #4506

Applies the config files inside the XDG_CONFIG_DIRS with the first file taking precedence.

@mjrochford mjrochford changed the title core: Config apply xdg system config files Config: apply xdg system config files Jan 9, 2025
Copy link
Contributor

@mitchellh mitchellh left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for building on @jcollie's work here and keeping the commit credits. I made some notes.

// We must reverse the order of the iterator because the first xdg config
// dir must takes importance per the spec https://specifications.freedesktop.org/basedir-spec/latest/#variables
var xdg_config_dirs = std.ArrayList([]const u8).init(alloc);
defer xdg_config_dirs.deinit();
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Instead of all this machinery, the DirIterator could do a reverse iteration using std.mem.lastIndexOf to implement your own iterator. I would recommend this route.

@mitchellh
Copy link
Contributor

Also please note my feedback on @jcollie's PR, it applies here as well.

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.

Load configuration from XDG_CONFIG_DIRS
3 participants