[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [14756] trunk/blender/source/blender/ python/BPY_interface.c: fix for [#10330] Can' t import packages or modules from a user defined script path in 2.46rc3, works in 2.45 (Windows)
Campbell Barton
ideasman42 at gmail.com
Fri May 9 00:07:00 CEST 2008
Revision: 14756
http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=14756
Author: campbellbarton
Date: 2008-05-09 00:07:00 +0200 (Fri, 09 May 2008)
Log Message:
-----------
fix for [#10330] Can't import packages or modules from a user defined script path in 2.46rc3, works in 2.45 (Windows)
Modified Paths:
--------------
trunk/blender/source/blender/python/BPY_interface.c
Modified: trunk/blender/source/blender/python/BPY_interface.c
===================================================================
--- trunk/blender/source/blender/python/BPY_interface.c 2008-05-08 21:39:08 UTC (rev 14755)
+++ trunk/blender/source/blender/python/BPY_interface.c 2008-05-08 22:07:00 UTC (rev 14756)
@@ -435,19 +435,24 @@
if(U.pythondir[0] != '\0' ) {
char modpath[FILE_MAX];
int upyslen = strlen(U.pythondir);
-
+ BLI_strncpy(dirpath, U.pythondir, FILE_MAX);
+
/* check if user pydir ends with a slash and, if so, remove the slash
* (for eventual implementations of c library's stat function that might
* not like it) */
- if (upyslen > 2) { /* avoids doing anything if dir == '//' */
- BLI_add_slash(U.pythondir);
+#ifdef WIN32
+ if (upyslen > 3) {
+#else if
+ if (upyslen > 1) {
+#endif
+ if (dirpath[upyslen-1] == '\\' || dirpath[upyslen-1] == '/') {
+ dirpath[upyslen-1] = '\0';
+ }
}
- BLI_strncpy(dirpath, U.pythondir, FILE_MAX);
BLI_convertstringcode(dirpath, G.sce);
syspath_append(dirpath); /* append to module search path */
-
- BLI_make_file_string("/", modpath, dirpath, "bpymodules");
+ BLI_join_dirfile( modpath, dirpath, "bpymodules" );
if (BLI_exists(modpath)) syspath_append(modpath);
}
More information about the Bf-blender-cvs
mailing list