-
Notifications
You must be signed in to change notification settings - Fork 17
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
Support XDG_DATA_HOME #168
base: main
Are you sure you want to change the base?
Conversation
I wouldn't expect us to dump Nerves hub files into the root of |
Ooo. Right. I need to make a subdir |
f1b23de
to
035a308
Compare
Fixed. Its following the pattern of Nerves a bit. We can be more aggressive in following XDG standard here if we want as to not default |
035a308
to
e18650f
Compare
I think that Nerves suffers from XDG_DATA_HOME apathy: we know it's the right thing to do, but no one cares enough to change it, and it is a breaking change to people who have XDG_DATA_HOME defined. I almost wonder if we've painted ourselves into a corner and if someone already has a |
Resolves #120
e18650f
to
cbe4515
Compare
Okay, I think I like how this is working. Application and env var get precedence. If it comes to the default and The only other thing to consider is if we want to travers |
def home_dir() do | ||
from_config = Application.get_env(:nerves_hub_cli, :home_dir) | ||
from_env = System.get_env("NERVES_HUB_HOME") | ||
xdg_home_nh = :filename.basedir(:user_data, "nerves-hub", %{os: :linux}) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
xdg_home_nh = :filename.basedir(:user_data, "nerves-hub", %{os: :linux}) | |
xdg_home_nh = :filename.basedir(:user_data, "nerves-hub") |
It seems like we should trust whatever basedir tells us that we should use for storing data so that this does the right thing on OSX. I "think" that renaming the variables to remove the XDG and updating the error text to refer to this as the user data directory below is what's needed to make this generic.
I.e., the same logic can still be used:
- Use
Application.get_env(:nerves_hub_cli, :home_dir)
- Use
$NERVES_HUB_HOME
- If
~/.nerves-hub
and not the:user_data
location, tell the user to move the directory - Use the
:user_data
location
Resolves #120