Better fix for initializing Android environment variables
This commit is contained in:
parent
095fb5f522
commit
ea2e2e451d
2 changed files with 3 additions and 7 deletions
|
@ -1525,7 +1525,8 @@ JNIEXPORT void JNICALL SDL_JAVA_INTERFACE(nativeSetenv)(
|
||||||
const char *utfvalue = (*env)->GetStringUTFChars(env, value, NULL);
|
const char *utfvalue = (*env)->GetStringUTFChars(env, value, NULL);
|
||||||
|
|
||||||
// This is only called at startup, to initialize the environment
|
// This is only called at startup, to initialize the environment
|
||||||
SDL_setenv_unsafe(utfname, utfvalue, 1);
|
// Note that we call setenv() directly to avoid affecting SDL environments
|
||||||
|
setenv(utfname, utfvalue, 1);
|
||||||
|
|
||||||
(*env)->ReleaseStringUTFChars(env, name, utfname);
|
(*env)->ReleaseStringUTFChars(env, name, utfname);
|
||||||
(*env)->ReleaseStringUTFChars(env, value, utfvalue);
|
(*env)->ReleaseStringUTFChars(env, value, utfvalue);
|
||||||
|
|
|
@ -122,12 +122,7 @@ SDL_Environment *SDL_CreateEnvironment(bool populated)
|
||||||
#else
|
#else
|
||||||
#ifdef SDL_PLATFORM_ANDROID
|
#ifdef SDL_PLATFORM_ANDROID
|
||||||
// Make sure variables from the application manifest are available
|
// Make sure variables from the application manifest are available
|
||||||
static bool initializing;
|
Android_JNI_GetManifestEnvironmentVariables();
|
||||||
if (!initializing) {
|
|
||||||
initializing = true;
|
|
||||||
Android_JNI_GetManifestEnvironmentVariables();
|
|
||||||
initializing = false;
|
|
||||||
}
|
|
||||||
#endif
|
#endif
|
||||||
char **strings = environ;
|
char **strings = environ;
|
||||||
if (strings) {
|
if (strings) {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue