Respect $XDG_DATA_HOME when looking for binaries

Since we're using the XDG base dir package in yabridgectl we were
already doing this there, so it makes sense to also do this in yabridge
itself even though it's very unlikely the user will have this set.
This commit is contained in:
Robbert van der Helm
2021-06-23 01:53:18 +02:00
parent 3ad70678da
commit 553b4474a7
3 changed files with 14 additions and 6 deletions
+6 -2
View File
@@ -373,8 +373,12 @@ std::vector<boost::filesystem::path> get_augmented_search_path() {
boost::this_process::path();
const bp::environment environment = boost::this_process::environment();
if (auto home_directory = environment.find("HOME");
home_directory != environment.end()) {
if (auto xdg_data_home = environment.find("XDG_DATA_HOME");
xdg_data_home != environment.end()) {
search_path.push_back(fs::path(xdg_data_home->to_string()) /
"yabridge");
} else if (auto home_directory = environment.find("HOME");
home_directory != environment.end()) {
search_path.push_back(fs::path(home_directory->to_string()) / ".local" /
"share" / "yabridge");
}