Always search for host in ~/.local/share/yabridge

This commit is contained in:
Robbert van der Helm
2020-11-20 02:20:41 +01:00
parent abb2206970
commit c69037b649
9 changed files with 122 additions and 45 deletions
+16 -1
View File
@@ -118,7 +118,8 @@ fs::path find_vst_host(PluginArchitecture plugin_arch, bool use_plugin_groups) {
// Boost will return an empty path if the file could not be found in the
// search path
const fs::path vst_host_path = bp::search_path(host_name);
const fs::path vst_host_path =
bp::search_path(host_name, get_modified_search_path());
if (vst_host_path == "") {
throw std::runtime_error("Could not locate '" + std::string(host_name) +
"'");
@@ -176,6 +177,20 @@ boost::filesystem::path generate_group_endpoint(
return get_temporary_directory() / socket_name.str();
}
std::vector<boost::filesystem::path> get_modified_search_path() {
std::vector<boost::filesystem::path> 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()) {
search_path.push_back(fs::path(home_directory->to_string()) / ".local" /
"share" / "yabridge");
}
return search_path;
}
fs::path get_this_file_location() {
// HACK: Not sure why, but `boost::dll::this_line_location()` returns a path
// starting with a double slash on some systems. I've seen this happen
+12 -1
View File
@@ -80,7 +80,8 @@ PluginArchitecture find_vst_architecture(boost::filesystem::path);
* when developing, as you can simply symlink the the libyabridge.so
* file in the build directory without having to install anything to
* /usr.
* 2. In the regular search path.
* 2. In the regular search path, augmented with `~/.local/share/yabridge` to
* ease the setup process.
*
* @param plugin_arch The architecture of the plugin, either 64-bit or 32-bit.
* Used to determine which host application to use, if available.
@@ -143,6 +144,16 @@ boost::filesystem::path generate_group_endpoint(
const boost::filesystem::path& wine_prefix,
const PluginArchitecture architecture);
/**
* 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
* makes sense to also search there by default.
*/
std::vector<boost::filesystem::path> get_modified_search_path();
/**
* Return a path to this `.so` file. This can be used to find out from where
* this link to or copy of `libyabridge.so` was loaded.