Fix for cmake + windows debug build crash on startup, PYTHONPATH needs to be set...
authorBrecht Van Lommel <brechtvanlommel@pandora.be>
Mon, 11 Jan 2010 11:11:21 +0000 (11:11 +0000)
committerBrecht Van Lommel <brechtvanlommel@pandora.be>
Mon, 11 Jan 2010 11:11:21 +0000 (11:11 +0000)
source/blender/python/intern/bpy_interface.c

index 2c1edc965e90f22333bb712a364d318d80029f67..611521073ef73e5fb351d63651cf06e5c26b9386 100644 (file)
@@ -299,9 +299,20 @@ void BPY_start_python_path(void)
                           \nThis may make python import function fail\n");
 #endif
        
-#if 0
-       BLI_setenv("PYTHONHOME", py_path_bundle);
-       BLI_setenv("PYTHONPATH", py_path_bundle);
+#ifdef _WIN32
+       /* cmake/MSVC debug build crashes without this, why only
+          in this case is unknown.. */
+       {
+               char *envpath = getenv("PYTHONPATH");
+
+               if(envpath && envpath[0]) {
+                       char *newenvpath = BLI_sprintfN("%s;%s", py_path_bundle, envpath);
+                       BLI_setenv("PYTHONPATH", newenvpath);
+                       MEM_freeN(newenvpath);
+               }
+               else
+                       BLI_setenv("PYTHONPATH", py_path_bundle);       
+       }
 #endif
 
        {