[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [20226] trunk/blender/source/gameengine/ Ketsji/KX_PythonInit.cpp: setting up the BGE Python sys. path for importing modules wasnt working for library paths.

Campbell Barton ideasman42 at gmail.com
Sat May 16 15:19:23 CEST 2009


Revision: 20226
          http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=20226
Author:   campbellbarton
Date:     2009-05-16 15:19:23 +0200 (Sat, 16 May 2009)

Log Message:
-----------
setting up the BGE Python sys.path for importing modules wasnt working for library paths.

Modified Paths:
--------------
    trunk/blender/source/gameengine/Ketsji/KX_PythonInit.cpp

Modified: trunk/blender/source/gameengine/Ketsji/KX_PythonInit.cpp
===================================================================
--- trunk/blender/source/gameengine/Ketsji/KX_PythonInit.cpp	2009-05-16 13:17:21 UTC (rev 20225)
+++ trunk/blender/source/gameengine/Ketsji/KX_PythonInit.cpp	2009-05-16 13:19:23 UTC (rev 20226)
@@ -1611,13 +1611,15 @@
 static void initPySysPath__append(PyObject *sys_path, char *filename)
 {
 	PyObject *item;
-	char expanded[FILE_MAXDIR + FILE_MAXFILE] = "//";
+	char expanded[FILE_MAXDIR + FILE_MAXFILE];
 	
-	BLI_convertstringcode(expanded, filename);
+	BLI_split_dirfile_basic(filename, expanded, NULL); /* get the dir part of filename only */
+	BLI_convertstringcode(expanded, gp_GamePythonPath);
 	
 	item= PyString_FromString(expanded);
 	
 	if(PySequence_Index(sys_path, item) == -1) {
+		PyErr_Clear(); /* PySequence_Index sets a ValueError */
 		PyList_Insert(sys_path, 0, item);
 	}
 	





More information about the Bf-blender-cvs mailing list