Skip to content

Commit

Permalink
Set wine env vars for all discovery methods
Browse files Browse the repository at this point in the history
Signed-off-by: falkTX <falktx@falktx.com>
  • Loading branch information
falkTX committed Nov 26, 2023
1 parent d362d14 commit f3d8dce
Showing 1 changed file with 25 additions and 22 deletions.
47 changes: 25 additions & 22 deletions source/backend/utils/PluginDiscovery.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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())
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit f3d8dce

Please sign in to comment.