mirror of
https://github.com/robbert-vdh/yabridge.git
synced 2026-05-07 03:50:11 +02:00
Prevent some allocations in environment lookups
In some places we'll still use the allocating non-const `operator[]` just because it would otherwise become pretty unreadable.
This commit is contained in:
@@ -256,12 +256,13 @@ fs::path normalize_plugin_path(const fs::path& windows_library_path,
|
||||
|
||||
std::variant<OverridenWinePrefix, fs::path, DefaultWinePrefix> find_wine_prefix(
|
||||
fs::path windows_plugin_path) {
|
||||
bp::environment env = boost::this_process::environment();
|
||||
if (!env["WINEPREFIX"].empty()) {
|
||||
return OverridenWinePrefix{env["WINEPREFIX"].to_string()};
|
||||
const bp::environment env = boost::this_process::environment();
|
||||
if (const auto prefix = env.find("WINEPREFIX");
|
||||
prefix != env.end() && !prefix->empty()) {
|
||||
return OverridenWinePrefix{prefix->to_string()};
|
||||
}
|
||||
|
||||
std::optional<fs::path> dosdevices_dir = find_dominating_file(
|
||||
const std::optional<fs::path> dosdevices_dir = find_dominating_file(
|
||||
"dosdevices", windows_plugin_path, fs::is_directory);
|
||||
if (!dosdevices_dir) {
|
||||
return DefaultWinePrefix{};
|
||||
|
||||
Reference in New Issue
Block a user