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

generator: Add config filename boilerplate to template (closes #80) #82

Merged
merged 1 commit into from
Jul 10, 2019

Conversation

tony-iqlusion
Copy link
Member

This adds boilerplate which includes the config filename, checks if it exists, and if not, ignores it.

Including this check in the boilerplate, and the explanatory comments around it, should hopefully be sufficient to address questions in #80.

This adds boilerplate which includes the config filename, checks if it
exists, and if not, ignores it.

Including this check in the boilerplate, and the explanatory comments
around it, should hopefully be sufficient to address questions in #80.
@tony-iqlusion tony-iqlusion merged commit 0e6526a into develop Jul 10, 2019
@tony-iqlusion tony-iqlusion deleted the add-config-file-to-template branch July 10, 2019 16:51
// Check if the config file exists, and if it does not, ignore it.
// If you'd like for a missing configuration file to be a hard error
// instead, always return `Some(CONFIG_FILE)` here.
let filename = PathBuf::from(CONFIG_FILE);
Copy link
Contributor

Choose a reason for hiding this comment

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

Maybe I'm missing something, but isn't this going to just try to open myapp.toml, without respect to where that config file should actually be located (e.g., /home/user/.config/, etc)?

Copy link
Collaborator

Choose a reason for hiding this comment

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

Yeah, as configured this will only look in CWD, which is agnostic to the questions you're asking, the answers to which will depend if the application in question is intended to be installed systemwide (several of ours are), or if you're using XDG directories as you suggest, or if you don't want to use XDG directories.

Getting a bit more specific is tricky, and in particular crates like dirs have a large number of transitive dependencies I'd like to avoid including by default (for my apps that do keep configs in the user's home directory, I'd rather just rely on the home crate).

This is definitely something that could use a bit more fleshing out though, and ideally unified with Abscissa's other path-handling functionality

@tony-iqlusion tony-iqlusion mentioned this pull request Jul 17, 2019
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.

None yet

3 participants