Use `setenv`instead as `putenv` makes Lutris' wine crash for some reason (threading?)

pull/316/head v0.5.1
jackun 4 years ago
parent 4f64e1403a
commit e56b7ded15
No known key found for this signature in database
GPG Key ID: 119DB3F1D05A9ED3

@ -727,18 +727,13 @@ void init_system_info(){
char *dir = dirname((char*)wineProcess.c_str()); char *dir = dirname((char*)wineProcess.c_str());
stringstream findVersion; stringstream findVersion;
findVersion << "\"" << dir << "/wine\" --version"; findVersion << "\"" << dir << "/wine\" --version";
bool env_exists = false; const char *wine_env = getenv("WINELOADERNOEXEC");
if (getenv("WINELOADERNOEXEC")) { if (wine_env)
static char removenoexec[] = "WINELOADERNOEXEC"; unsetenv("WINELOADERNOEXEC");
putenv(removenoexec);
env_exists = true;
}
wineVersion = exec(findVersion.str()); wineVersion = exec(findVersion.str());
std::cout << "WINE VERSION = " << wineVersion << "\n"; std::cout << "WINE VERSION = " << wineVersion << "\n";
if (env_exists) { if (wine_env)
static char noexec[] = "WINELOADERNOEXEC=1"; setenv("WINELOADERNOEXEC", wine_env, 1);
putenv(noexec);
}
} }
} }
else { else {

Loading…
Cancel
Save