fix for [#10330] Can't import packages or modules from a user defined script path in 2.46rc3, works in 2.45 (Windows)

This commit is contained in:
Campbell Barton 2008-05-08 22:07:00 +00:00
parent 1d043ddf19
commit cfcdf36cd8

@ -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);
}