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:
-rw-r--r--source/blender/blenlib/BLI_util.h1
-rw-r--r--source/blender/blenlib/intern/util.c18
-rw-r--r--source/blender/python/intern/bpy_interface.c24
-rw-r--r--source/creator/creator.c22
4 files changed, 25 insertions, 40 deletions
diff --git a/source/blender/blenlib/BLI_util.h b/source/blender/blenlib/BLI_util.h
index d323f701ba5..f9a84e071e7 100644
--- a/source/blender/blenlib/BLI_util.h
+++ b/source/blender/blenlib/BLI_util.h
@@ -43,6 +43,7 @@ struct direntry;
char *BLI_gethome(void);
char *BLI_gethome_folder(char *folder_name);
+void BLI_setenv(const char *env, const char *val);
void BLI_make_file_string(const char *relabase, char *string, const char *dir, const char *file);
void BLI_make_exist(char *dir);
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)
{
diff --git a/source/blender/python/intern/bpy_interface.c b/source/blender/python/intern/bpy_interface.c
index 76852d99b56..1a2bb57a423 100644
--- a/source/blender/python/intern/bpy_interface.c
+++ b/source/blender/python/intern/bpy_interface.c
@@ -160,28 +160,8 @@ void BPY_start_python_path(void)
/* set the environment path */
printf("found bundled python: %s\n", py_path_bundle);
-#if (defined(WIN32) || defined(WIN64))
-#if defined(FREE_WINDOWS)
- {
- char py_path[FILE_MAXDIR + 11] = "";
- sprintf(py_path, "PYTHONPATH=%s", py_path_bundle);
- putenv(py_path);
- }
-#else
- _putenv_s("PYTHONPATH", py_path_bundle);
-#endif
-#else
-#ifdef __sgi
- {
- char py_path[FILE_MAXDIR + 11] = "";
- sprintf(py_path, "PYTHONPATH=%s", py_path_bundle);
- putenv(py_path);
- }
-#else
- setenv("PYTHONPATH", py_path_bundle, 1);
-#endif
-#endif
-
+ BLI_setenv("PYTHONHOME", py_path_bundle);
+ BLI_setenv("PYTHONPATH", py_path_bundle);
}
diff --git a/source/creator/creator.c b/source/creator/creator.c
index 45288bfb9b5..8e0152b5e63 100644
--- a/source/creator/creator.c
+++ b/source/creator/creator.c
@@ -501,25 +501,11 @@ int main(int argc, char **argv)
BLI_where_is_temp( btempdir, 1 ); /* call after loading the .B.blend so we can read U.tempdir */
#ifndef DISABLE_SDL
-#if (defined(WIN32) || defined(WIN64))
-#if defined(FREE_WINDOWS)
- putenv("SDL_VIDEODRIVER=dummy");
-#else
- _putenv_s("SDL_VIDEODRIVER", "dummy");
-#endif
-#else
-#ifdef __sgi
- putenv("SDL_VIDEODRIVER=dummy");
-#else
- setenv("SDL_VIDEODRIVER", "dummy", 1); /* initializing the video driver can cause crashes on some systems - Campbell */
-#endif
-#endif
+ BLI_setenv("SDL_VIDEODRIVER", "dummy");
#ifdef __linux__
- /* On linux the default SDL driver dma often would not play
- * use alsa if none is set */
- if ( getenv("SDL_AUDIODRIVER") == NULL) {
- setenv("SDL_AUDIODRIVER", "alsa", 1);
- }
+ /* On linux the default SDL driver dma often would not play
+ * use alsa if none is set */
+ setenv("SDL_AUDIODRIVER", "alsa", 0);
#endif
#endif
}