softwaremill / scala-clippy

Good advice for Scala compiler errors
Apache License 2.0
312 stars 20 forks source link

Store cached data in XDG-defined paths, not ~/.clippy #29

Open Daenyth opened 7 years ago

Daenyth commented 7 years ago

A lot of linux users really dislike random apps cluttering ~/.foo directories; It's recommended to use XDG paths instead.

https://standards.freedesktop.org/basedir-spec/basedir-spec-latest.html

Clippy would use $XDG_CACHE_HOME/clippy, defaulting to ~/.cache/clippy/

adamw commented 7 years ago

Didn't know about that, thanks :) I suppose ~/.cache/clippy would be a good default for macos too.

You don't know what's the convention on windows, by chance?

And maybe you'd like to try a PR? This would probably be a change to the default in ClippyPlugin

Daenyth commented 7 years ago

Windows would probably be %APPDATA_LOCAL% iirc but I don't use it myself so I'm not sure. If I have time I can pr in. Likely I'll make it check the old location and move the files to avoid extra bandwidth usage if I have time to write it

On Tue, Dec 20, 2016, 3:59 AM Adam Warski notifications@github.com wrote:

Didn't know about that, thanks :) I suppose ~/.cache/clippy would be a good default for macos too.

You don't know what's the convention on windows, by chance?

And maybe you'd like to try a PR? This would probably be a change to the default in ClippyPlugin

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/softwaremill/scala-clippy/issues/29#issuecomment-268190078, or mute the thread https://github.com/notifications/unsubscribe-auth/AAA5NLpSMF98BOW-R9MtgWe7dtkQYw14ks5rJ5kFgaJpZM4LQvSw .

adamw commented 7 years ago

If you would find the time, that would be great :)

Not sure if it's worth moving from the old location, as the gzipped file is now about 2KB

Daenyth commented 7 years ago

I'm not sure how best to handle windows. Right now it's using the user.home java property, but I'd need to switch to checking environment variables. I suppose I could check for the windows one along with the xdg ones, it just seems a little unfortunate that I'll have to effectively add code path branches vs what it's doing now

adamw commented 7 years ago

Well, if different OSes have different conventions for cache-like local storage, then adding conditional code wouldn't seem wrong in any way to me :) Maybe this could be separate object?