mirror of
https://github.com/robbert-vdh/yabridge.git
synced 2026-06-15 07:53:55 +02:00
Fix plugin groups outside of Wine prefixes
Boost.Process's `boost::process::environment::at` throws when the environment variable does not exist, as opposed to `operator[]` which falls back to an empty value.
This commit is contained in:
@@ -8,6 +8,11 @@ Versioning](https://semver.org/spec/v2.0.0.html).
|
|||||||
|
|
||||||
## [Unreleased]
|
## [Unreleased]
|
||||||
|
|
||||||
|
### Fixed
|
||||||
|
|
||||||
|
- Fixed an initialization error when using plugin groups for plugins that are
|
||||||
|
installed outside of a Wine prefix.
|
||||||
|
|
||||||
### yabridgectl
|
### yabridgectl
|
||||||
|
|
||||||
- Resolve relative paths when adding plugin directories or when changing
|
- Resolve relative paths when adding plugin directories or when changing
|
||||||
|
|||||||
@@ -149,8 +149,14 @@ GroupHost::GroupHost(
|
|||||||
// the first process will handle the connections for both yabridge
|
// the first process will handle the connections for both yabridge
|
||||||
// instances.
|
// instances.
|
||||||
const bp::environment host_env = set_wineprefix();
|
const bp::environment host_env = set_wineprefix();
|
||||||
fs::path wine_prefix = host_env.at("WINEPREFIX").to_string();
|
fs::path wine_prefix;
|
||||||
if (host_env.at("WINEPREFIX").empty()) {
|
if (auto wine_prefix_envvar = host_env.find("WINEPREFIX");
|
||||||
|
wine_prefix_envvar != host_env.end()) {
|
||||||
|
// This is a bit ugly, but Boost.Process's environment does not have a
|
||||||
|
// graceful way to check for empty environment variables in const
|
||||||
|
// qualified environments
|
||||||
|
wine_prefix = wine_prefix_envvar->to_string();
|
||||||
|
} else {
|
||||||
// Fall back to `~/.wine` if this has not been set or detected. This
|
// Fall back to `~/.wine` if this has not been set or detected. This
|
||||||
// would happen if the plugin's .dll file is not inside of a Wine
|
// would happen if the plugin's .dll file is not inside of a Wine
|
||||||
// prefix. If this happens, then the Wine instance will be launched in
|
// prefix. If this happens, then the Wine instance will be launched in
|
||||||
|
|||||||
Reference in New Issue
Block a user