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

Make fields of BaseDirectories public #65

Merged
merged 2 commits into from
Jan 2, 2024
Merged

Conversation

piegamesde
Copy link
Contributor

Closes #44.

I was initially aiming for making with_env public, but then I noticed that the struct has minimal invariants, so its fields can be made public. Also added some documentation to make more clear which variable contains what exactly, as the prefixes make this somewhat non-obvious.

While doing this I also noted a slight inconsistency: get_runtime_directory does not add any prefixes, however the get_XXX_home functions do. Changing this would require a backwards incompatible change however.

@piegamesde
Copy link
Contributor Author

Note that I marked the struct as non_exhaustive so that additions of new variables will not cause backwards incompatible changes. This comes at the cost of having to bump MSRV (finding which Rust version introduced the feature was surprisingly painful), and not being able to directly construct the type. I think it closes #44 nevertheless, because one can take the default value or one of the constructors and then modify the remaining values as desired.

I do think the idea of exposing with_env still has some merit, but that change can be made later on independently.

@whitequark whitequark merged commit f7e701e into whitequark:main Jan 2, 2024
3 checks passed
@whitequark
Copy link
Owner

Thanks!

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.

Manually create a xdg::BaseDirectories value
2 participants