diff options
author | Campbell Barton <ideasman42@gmail.com> | 2010-06-06 01:19:59 +0400 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2010-06-06 01:19:59 +0400 |
commit | 4da179749eb8d6b53f5c2eba4b3e4132656c3d4f (patch) | |
tree | 59b4dbfac1c894687f022efb72a9c010c93e555f /source/blender/blenlib/intern | |
parent | c12068920391c006cf5e72c1fafb4ebf8f807a55 (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/blenlib/intern')
-rw-r--r-- | source/blender/blenlib/intern/bpath.c | 5 | ||||
-rw-r--r-- | source/blender/blenlib/intern/path_util.c | 6 |
2 files changed, 8 insertions, 3 deletions
diff --git a/source/blender/blenlib/intern/bpath.c b/source/blender/blenlib/intern/bpath.c index 9b1d29e6e12..a56cbb65538 100644 --- a/source/blender/blenlib/intern/bpath.c +++ b/source/blender/blenlib/intern/bpath.c @@ -661,7 +661,7 @@ void findMissingFiles(char *basepath, char *str) { char filepath[FILE_MAX], *libpath; int filesize, recur_depth; - char dirname[FILE_MAX], filename[FILE_MAX], filename_new[FILE_MAX]; + char dirname[FILE_MAX], filename_new[FILE_MAX]; //XXX waitcursor( 1 ); @@ -686,9 +686,8 @@ void findMissingFiles(char *basepath, char *str) { /* can the dir be opened? */ filesize = -1; recur_depth = 0; - BLI_split_dirfile(filepath, NULL, filename); /* the file to find */ - findFileRecursive(filename_new, dirname, filename, &filesize, &recur_depth); + findFileRecursive(filename_new, dirname, BLI_path_basename(filepath), &filesize, &recur_depth); if (filesize == -1) { /* could not open dir */ printf("Could not open dir \"%s\"\n", dirname); return; diff --git a/source/blender/blenlib/intern/path_util.c b/source/blender/blenlib/intern/path_util.c index 301b981cdc7..f91c38b8271 100644 --- a/source/blender/blenlib/intern/path_util.c +++ b/source/blender/blenlib/intern/path_util.c @@ -1172,6 +1172,12 @@ void BLI_join_dirfile(char *string, const char *dir, const char *file) } } +/* like pythons os.path.basename( ) */ +char *BLI_path_basename(char *path) +{ + const char *filename= BLI_last_slash(path); + return filename ? filename + 1 : path; +} /* Produce image export path. |