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 file not in the designated place on MacOS #23

Closed
augustebaum opened this issue Feb 8, 2021 · 9 comments
Closed

Config file not in the designated place on MacOS #23

augustebaum opened this issue Feb 8, 2021 · 9 comments
Assignees
Labels
done Issue is fixed

Comments

@augustebaum
Copy link

As mentioned, I'm on MacOS.

Expected:
what is shown in the help message when flavours is run on its own, that is:

  • The config file is by default ~/.config/flavours/config.toml,
  • The data file is by default ~/.local/share/flavours,

Got:

  • Both files are put in ~/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!

@Misterio77
Copy link
Owner

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.

@Misterio77
Copy link
Owner

Thanks for trying out flavours and for your feedback too <3

@augustebaum
Copy link
Author

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.

@Misterio77
Copy link
Owner

Sure thing, i'll add env vars for these, then

@Misterio77 Misterio77 added the todo Just needs to be fixed label Feb 9, 2021
@Misterio77 Misterio77 self-assigned this Feb 9, 2021
@Misterio77
Copy link
Owner

Misterio77 commented Feb 9, 2021

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)

@Misterio77 Misterio77 added done Issue is fixed and removed todo Just needs to be fixed labels Feb 10, 2021
@augustebaum
Copy link
Author

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.

@Misterio77
Copy link
Owner

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)

@augustebaum
Copy link
Author

Thanks, I'll try it out then!

Misterio77 pushed a commit that referenced this issue Feb 18, 2021
Updated usage gif

Added nixpkg link

Added info about env vars (#23)

Added link to Snider's video series

Fix broken example links
@Vixeliz
Copy link

Vixeliz commented Mar 9, 2023

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?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
done Issue is fixed
Projects
None yet
Development

No branches or pull requests

3 participants