nmeum / android-tools

Unoffical CMake-based build system for android command line utilities
Apache License 2.0
191 stars 57 forks source link

Add XDG-compliance patch on Linux #50

Closed nikp123 closed 2 years ago

nikp123 commented 2 years ago

On Linux many apps obey the XDG/freedesktop standards for where files should be placed and that in-turn ends up being a nicer user experience for many people as they won't have to navigate through the clutter of dotfiles that everyone has to (unfortunately) deal with. This patch is simply to make ADB conform to those standards as well.

Read about it here: https://wiki.archlinux.org/title/XDG_Base_Directory

This doesn't break the application in any way. In fact, I added a fallback "just in case".

For ADB this should be the obvious choice since it's files aren't that important to justify their place directly on the user's $HOME directory. It's mostly keys and session numbers, which could be considered DATA and hence placed in the XDG_DATA directory (Located under ~/.local/share)

Johnnynator commented 2 years ago

This patch would break existing installations, since it ignores the old keys if XDG_DATA_HOME is set.

Also I think the spec does expect programms to use $HOME/.local/share as fallback for XDG_DATA_HoME

nmeum commented 2 years ago

I think I would personally prefer not to include changes to functional behavior in this repo. The patches we are presently shipping mostly focus on fixing compilation issues, not on adding any new features. If you want adb to obey the XDG Base Directory Specification I would suggest proposing this to AOSP (Android Open Source Project) upstream.

nikp123 commented 2 years ago

Thank you for the feedback, I was mostly targeting this as it's a source of the adb package for many Linux distros, but I understand your concerns. Moving discussion there.

nikp123 commented 2 years ago

Conversation continued here: https://issuetracker.google.com/issues/160478861