diff --git a/source/backend/utils/PluginDiscovery.cpp b/source/backend/utils/PluginDiscovery.cpp index dac350162e..9392d92a08 100644 --- a/source/backend/utils/PluginDiscovery.cpp +++ b/source/backend/utils/PluginDiscovery.cpp @@ -440,6 +440,31 @@ class CarlaPluginDiscovery : private CarlaPipeServer default: break; } + + String winePrefix; + + if (options.wine.autoPrefix && !fBinaries.empty()) + { + const File file(fBinaries[fBinaryIndex]); + const String filename(file.getFullPathName()); + + winePrefix = findWinePrefix(filename); + } + + if (winePrefix.isEmpty()) + { + const char* const envWinePrefix = std::getenv("WINEPREFIX"); + + if (envWinePrefix != nullptr && envWinePrefix[0] != '\0') + winePrefix = envWinePrefix; + else if (options.wine.fallbackPrefix != nullptr && options.wine.fallbackPrefix[0] != '\0') + winePrefix = options.wine.fallbackPrefix.buffer(); + else + winePrefix = File::getSpecialLocation(File::userHomeDirectory).getFullPathName() + "/.wine"; + } + + const CarlaScopedEnvVar sev1("WINEDEBUG", "-all"); + const CarlaScopedEnvVar sev2("WINEPREFIX", winePrefix.toRawUTF8()); #endif if (fBinaries.empty()) @@ -468,28 +493,6 @@ class CarlaPluginDiscovery : private CarlaPipeServer } } - #ifndef CARLA_OS_WIN - String winePrefix; - - if (options.wine.autoPrefix) - winePrefix = findWinePrefix(filename); - - if (winePrefix.isEmpty()) - { - const char* const envWinePrefix = std::getenv("WINEPREFIX"); - - if (envWinePrefix != nullptr && envWinePrefix[0] != '\0') - winePrefix = envWinePrefix; - else if (options.wine.fallbackPrefix != nullptr && options.wine.fallbackPrefix[0] != '\0') - winePrefix = options.wine.fallbackPrefix.buffer(); - else - winePrefix = File::getSpecialLocation(File::userHomeDirectory).getFullPathName() + "/.wine"; - } - - const CarlaScopedEnvVar sev1("WINEDEBUG", "-all"); - const CarlaScopedEnvVar sev2("WINEPREFIX", winePrefix.toRawUTF8()); - #endif - carla_stdout("Scanning \"%s\"...", filename.toRawUTF8()); #ifndef CARLA_OS_WIN