Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCampbell Barton <ideasman42@gmail.com>2010-06-06 01:19:59 +0400
committerCampbell Barton <ideasman42@gmail.com>2010-06-06 01:19:59 +0400
commit4da179749eb8d6b53f5c2eba4b3e4132656c3d4f (patch)
tree59b4dbfac1c894687f022efb72a9c010c93e555f /source/blender/python
parentc12068920391c006cf5e72c1fafb4ebf8f807a55 (diff)
- [#22492] [29159] commit breaks importing of script file that has a reload to self in it
broke when including the blend path in the modules filename. - new function BLI_path_basename(), matches pythons os.path.basename(). replace a number of cases where BLI_split_dirfile was being used to get the filename only.
Diffstat (limited to 'source/blender/python')
-rw-r--r--source/blender/python/generic/bpy_internal_import.c11
1 files changed, 6 insertions, 5 deletions
diff --git a/source/blender/python/generic/bpy_internal_import.c b/source/blender/python/generic/bpy_internal_import.c
index 6ac63499988..01d0f56bf1b 100644
--- a/source/blender/python/generic/bpy_internal_import.c
+++ b/source/blender/python/generic/bpy_internal_import.c
@@ -34,6 +34,7 @@
#include "BKE_main.h"
#include "BKE_global.h" /* grr, only for G.sce */
#include "BLI_listbase.h"
+#include "BLI_path_util.h"
#include <stddef.h>
static Main *bpy_import_main= NULL;
@@ -129,8 +130,8 @@ PyObject *bpy_text_import_name( char *name, int *found )
PyObject *bpy_text_reimport( PyObject *module, int *found )
{
Text *text;
- const char *txtname;
const char *name;
+ char *filepath;
char *buf = NULL;
//XXX Main *maggie= bpy_import_main ? bpy_import_main:G.main;
Main *maggie= bpy_import_main;
@@ -143,14 +144,14 @@ PyObject *bpy_text_reimport( PyObject *module, int *found )
*found= 0;
/* get name, filename from the module itself */
+ if((name= PyModule_GetName(module)) == NULL)
+ return NULL;
- txtname = PyModule_GetFilename( module );
- name = PyModule_GetName( module );
- if( !txtname || !name)
+ if((filepath= (char *)PyModule_GetFilename(module)) == NULL)
return NULL;
/* look up the text object */
- text= BLI_findstring(&maggie->text, txtname, offsetof(ID, name) + 2);
+ text= BLI_findstring(&maggie->text, BLI_path_basename(filepath), offsetof(ID, name) + 2);
/* uh-oh.... didn't find it */
if( !text )