Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCampbell Barton <ideasman42@gmail.com>2009-07-21 13:26:28 +0400
committerCampbell Barton <ideasman42@gmail.com>2009-07-21 13:26:28 +0400
commit0ebf23c0b8de670ea856757f6950c515efd87a71 (patch)
tree12b1b3127bbcdd831d7a68e985992f488113c8b3 /source/blender/blenlib/intern/util.c
parentca466dc8d825e06255e4b76507dbb5e052ede693 (diff)
BLI_setenv, use instead of copying ifdefs about for setting env vars.
set PYTHONHOME as well as PYTHONPATH, quiets some warnings.
Diffstat (limited to 'source/blender/blenlib/intern/util.c')
-rw-r--r--source/blender/blenlib/intern/util.c18
1 files changed, 18 insertions, 0 deletions
diff --git a/source/blender/blenlib/intern/util.c b/source/blender/blenlib/intern/util.c
index 8eeca6900a1..3c441a81d6b 100644
--- a/source/blender/blenlib/intern/util.c
+++ b/source/blender/blenlib/intern/util.c
@@ -951,6 +951,24 @@ char *BLI_gethome_folder(char *folder_name)
return NULL;
}
+void BLI_setenv(const char *env, const char*val)
+{
+ /* SGI or free windows */
+#if (defined(__sgi) || ((defined(WIN32) || defined(WIN64)) && defined(FREE_WINDOWS)))
+ char *envstr= malloc(sizeof(char) * (strlen(env) + strlen(val) + 2)); /* one for = another for \0 */
+
+ sprintf(envstr, "%s=%s", env, val);
+ putenv(envstr);
+ free(envstr);
+
+ /* non-free windows */
+#elif (defined(WIN32) || defined(WIN64)) /* not free windows */
+ _putenv_s(env, val);
+#else
+ /* linux/osx/bsd */
+ setenv(env, val, 1);
+#endif
+}
void BLI_clean(char *path)
{