Closed augustebaum closed 3 years ago
Hey.
Flavours uses the dirs library for the default directories.
More specifically, config_dir
for config.toml, and data_dir
for the data files.
It seems that both default to ~/Library/Application Support/
, which is kinda weird.
I'm not really sure how MacOS' home directories are structured, but is ~/Library/Preferences
preferrable for configuration files? It seems dirs also includes preference_dir, which is exactly the same as config_dir
, but with ~/Library/Preferences
for MacOS instead.
I'll make this change and try to include some docs about the default directories on other OSes, if you think that solves the problem.
About using custom config or data directory paths, you can specify --config
(or -c
) and --directory
(or -d
) with any flavours command, for example flavours -c example.toml -d data apply
.
Thanks for trying out flavours and for your feedback too <3
I'm not really sure how MacOS home directories are structured, but is ~/Library/Preferences preferrable for configuration files?
I personally have a .config
and .local
in my home, though I can't recall whether it was there before or if I made it this way. Many other CLI apps use this structure, including on MacOS (but many don't, unfortunately). For me MacOS counts as a *nix so the defaults (the Linux ones) are sensible. I've never seen an app use the Library/
paths for configs that I am expected to tailor to my needs, only for prewritten configs that aren't meant to be changed (like many things in MacOS!).
About using custom config or data directory paths, you can specify --config (or -c) and --directory (or -d) with any flavours command, for example flavours -c example.toml -d data apply.
Indeed, and I set an alias for flavours using those:
alias flavours="flavours -c ~/.config/flavours/config.toml -d ~/.local/share/flavours"
but I'd rather it be set with an environment variable.
I hope all this makes sense; thanks for the quick response. Really glad to contribute to making this even better.
Sure thing, i'll add env vars for these, then
Just implemented this. You can now use the environment variables FLAVOURS_DATA_DIRECTORY
and FLAVOURS_CONFIG_FILE
to set these.
(Let me know if it works ok)
Is it possible to test this change using cargo
or would I have to wait until the next release? Sorry, I'm a bit new to this.
Is it possible to test this change using
cargo
or would I have to wait until the next release? Sorry, I'm a bit new to this.
Haha don't worry.
Yes, the way to test the changes before i release a new version is cloning the repository, cd'ing into it, and building with cargo
, then running and testing to see if it all works.
You can easily build with cargo build
. The resulting binary will be on target/debug/flavours
.
You can also build & run with cargo run
(to use flavours arguments, you can use it like cargo run -- --version
).
You can even run cargo install
to have cargo install for your user (You would then need to add the cargo folder to your path, i'm not sure where it is on MacOS, but on linux it is ~/.cargo/bin
)
Thanks, I'll try it out then!
Sorry for commenting on an old issue but on macos it seems like the custom schemes and templates folder don't work. Any chance at an env var for the config directory instead of file?
As mentioned, I'm on MacOS.
Expected: what is shown in the help message when
flavours
is run on its own, that is:~/.config/flavours/config.toml
,~/.local/share/flavours
,Got:
~/Library/Application Support/flavours/
That wouldn't be a problem except for the fact that the help message is misleading and I cannot figure out how to change the config and data files to their rightful place.
Really liking the project apart from that, thanks!