0.2.0-dev Download ZIP
55 lines ·1.7 KB Raw
| 1 | diff --git a/thirdparty/sdl/stdlib/SDL_getenv.c b/thirdparty/sdl/stdlib/SDL_getenv.c |
| 2 | index 2626b62717b..d66751a2105 100644 |
| 3 | --- a/thirdparty/sdl/stdlib/SDL_getenv.c |
| 4 | +++ b/thirdparty/sdl/stdlib/SDL_getenv.c |
| 5 | @@ -153,6 +153,9 @@ SDL_Environment *SDL_CreateEnvironment(bool populated) |
| 6 | |
| 7 | const char *SDL_GetEnvironmentVariable(SDL_Environment *env, const char *name) |
| 8 | { |
| 9 | +#if defined(SDL_PLATFORM_LINUX) || defined(SDL_PLATFORM_MACOS) || defined(SDL_PLATFORM_FREEBSD) |
| 10 | + return getenv(name); |
| 11 | +#else |
| 12 | const char *result = NULL; |
| 13 | |
| 14 | if (!env) { |
| 15 | @@ -172,6 +175,7 @@ const char *SDL_GetEnvironmentVariable(SDL_Environment *env, const char *name) |
| 16 | SDL_UnlockMutex(env->lock); |
| 17 | |
| 18 | return result; |
| 19 | +#endif |
| 20 | } |
| 21 | |
| 22 | typedef struct CountEnvStringsData |
| 23 | @@ -250,6 +254,9 @@ char **SDL_GetEnvironmentVariables(SDL_Environment *env) |
| 24 | |
| 25 | bool SDL_SetEnvironmentVariable(SDL_Environment *env, const char *name, const char *value, bool overwrite) |
| 26 | { |
| 27 | +#if defined(SDL_PLATFORM_LINUX) || defined(SDL_PLATFORM_MACOS) || defined(SDL_PLATFORM_FREEBSD) |
| 28 | + return setenv(name, value, overwrite); |
| 29 | +#else |
| 30 | bool result = false; |
| 31 | |
| 32 | CHECK_PARAM(!env) { |
| 33 | @@ -287,10 +294,14 @@ bool SDL_SetEnvironmentVariable(SDL_Environment *env, const char *name, const ch |
| 34 | SDL_UnlockMutex(env->lock); |
| 35 | |
| 36 | return result; |
| 37 | +#endif |
| 38 | } |
| 39 | |
| 40 | bool SDL_UnsetEnvironmentVariable(SDL_Environment *env, const char *name) |
| 41 | { |
| 42 | +#if defined(SDL_PLATFORM_LINUX) || defined(SDL_PLATFORM_MACOS) || defined(SDL_PLATFORM_FREEBSD) |
| 43 | + return unsetenv(name); |
| 44 | +#else |
| 45 | bool result = false; |
| 46 | |
| 47 | CHECK_PARAM(!env) { |
| 48 | @@ -312,6 +323,7 @@ bool SDL_UnsetEnvironmentVariable(SDL_Environment *env, const char *name) |
| 49 | SDL_UnlockMutex(env->lock); |
| 50 | |
| 51 | return result; |
| 52 | +#endif |
| 53 | } |
| 54 | |
| 55 | void SDL_DestroyEnvironment(SDL_Environment *env) |