From 4da179749eb8d6b53f5c2eba4b3e4132656c3d4f Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Sat, 5 Jun 2010 21:19:59 +0000 Subject: - [#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. --- source/blender/blenkernel/intern/text.c | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) (limited to 'source/blender/blenkernel/intern/text.c') diff --git a/source/blender/blenkernel/intern/text.c b/source/blender/blenkernel/intern/text.c index f1036b66f69..e8328d0e622 100644 --- a/source/blender/blenkernel/intern/text.c +++ b/source/blender/blenkernel/intern/text.c @@ -232,7 +232,6 @@ int reopen_text(Text *text) int i, llen, len, res; unsigned char *buffer; TextLine *tmp; - char sfile[FILE_MAXFILE]; char str[FILE_MAXDIR+FILE_MAXFILE]; struct stat st; @@ -240,7 +239,6 @@ int reopen_text(Text *text) BLI_strncpy(str, text->name, FILE_MAXDIR+FILE_MAXFILE); BLI_path_abs(str, G.sce); - BLI_split_dirfile(str, NULL, sfile); fp= fopen(str, "r"); if(fp==NULL) return 0; @@ -331,19 +329,17 @@ Text *add_text(char *file, const char *relpath) unsigned char *buffer; TextLine *tmp; Text *ta; - char sfile[FILE_MAXFILE]; char str[FILE_MAXDIR+FILE_MAXFILE]; struct stat st; BLI_strncpy(str, file, FILE_MAXDIR+FILE_MAXFILE); if (relpath) /* can be NULL (bg mode) */ BLI_path_abs(str, relpath); - BLI_split_dirfile(str, NULL, sfile); fp= fopen(str, "r"); if(fp==NULL) return NULL; - ta= alloc_libblock(&G.main->text, ID_TXT, sfile); + ta= alloc_libblock(&G.main->text, ID_TXT, BLI_path_basename(str)); ta->id.us= 1; ta->lines.first= ta->lines.last= NULL; -- cgit v1.2.3