From cfcdf36cd8fc1ff88d0cf953b00f207fdef9fe83 Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Thu, 8 May 2008 22:07:00 +0000 Subject: [PATCH] fix for [#10330] Can't import packages or modules from a user defined script path in 2.46rc3, works in 2.45 (Windows) --- source/blender/python/BPY_interface.c | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/source/blender/python/BPY_interface.c b/source/blender/python/BPY_interface.c index ffdb593767a..1496495e5aa 100644 --- a/source/blender/python/BPY_interface.c +++ b/source/blender/python/BPY_interface.c @@ -435,19 +435,24 @@ void BPY_rebuild_syspath( void ) 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); }