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
+3
View File
@@ -34,6 +34,9 @@ Versioning](https://semver.org/spec/v2.0.0.html).
allocations in certain situations. This is related to the similar issue that
got fixed with yabridge 3.3.0. A fix for this issue has also been upstreamed
to the library.
- Respect `$XDG_DATA_HOME` when looking for yabridge's plugin host binaries
instead of hardcoding `~/.local/share/yabridge`. This matches the existing
behaviour in yabridgectl.
### Fixed
+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");
}
+5 -4
View File
@@ -227,10 +227,11 @@ boost::filesystem::path generate_group_endpoint(
/**
* Return the search path as defined in `$PATH`, with `~/.local/share/yabridge`
* appended to the end. I'd rather not do this since more magic makes things
* harder to comprehend, but I can understand that modifying your login shell's
* `PATH` environment variable can be a big hurdle if you've never done anything
* like that before. And since this is the recommended installation location, it
* appended to the end. Even though it likely won't be set, this does respect
* `$XDG_DATA_HOME`. I'd rather not do this since more magic makes things harder
* to comprehend, but I can understand that modifying your login shell's `PATH`
* environment variable can be a big hurdle if you've never done anything like
* that before. And since this is the recommended installation location, it
* makes sense to also search there by default.
*/
std::vector<boost::filesystem::path> get_augmented_search_path();