whitequark / rust-xdg

A library that makes it easy to follow the X Desktop Group specifications
https://wiki.freedesktop.org/www/Specifications/
Apache License 2.0
154 stars 30 forks source link

Use `std::env::home_dir` instead of `std::env::var_os("HOME")` #3

Closed tbu- closed 8 years ago

tbu- commented 8 years ago

std::env::home_dir has a sensible fallback in case $HOME is not set.

whitequark commented 8 years ago

USERPROFILE is Windows-only. What is the purpose of this change?

tbu- commented 8 years ago

The fallback exists, it just isn't documented. See https://github.com/rust-lang/rust/pull/29690.

whitequark commented 8 years ago

OK. But what is the value of the change? If HOME is not set, the environment is not even nearly XDG compliant, I believe...

tbu- commented 8 years ago

The value is that the library doesn't panic in this case, making it more useful for programs trying to be robust.

I wanted to use this library to make cargo XDG-compliant, but they probably won't like it if it generated an error in more cases due to such a change.

whitequark commented 8 years ago

Hm, it's true that something like cargo shouldn't really care if the environment is perfectly XDG compliant or not.

tbu- commented 8 years ago

Thanks!