diff options
author | Andrea Weikert <elubie@gmx.net> | 2007-03-01 00:37:14 +0300 |
---|---|---|
committer | Andrea Weikert <elubie@gmx.net> | 2007-03-01 00:37:14 +0300 |
commit | c7ad7cd1b03e2a6a5ddc9399264b9bdd2527a60d (patch) | |
tree | cdedceaca97511af60f35795b1c0c76b9e587d99 /source | |
parent | a734d3cc27a381f0c37835c14653ff8802ebca14 (diff) |
=== bugfix ===
[ #6077 ] Scripts in sub-sub-folders of Blender's scripts folder won't run.
[ #5572 ] Scripts in sub-folders of Blender's scripts folder won't run
- I've added a function in blenlib to join two strings with a path separator in between.
- Willian, Campbell, please check if commit in BPY_menus is ok and test - thanks!
Diffstat (limited to 'source')
-rw-r--r-- | source/blender/blenlib/BLI_blenlib.h | 1 | ||||
-rw-r--r-- | source/blender/blenlib/intern/util.c | 19 | ||||
-rw-r--r-- | source/blender/python/BPY_menus.c | 13 |
3 files changed, 23 insertions, 10 deletions
diff --git a/source/blender/blenlib/BLI_blenlib.h b/source/blender/blenlib/BLI_blenlib.h index 58bd3fd6bf6..7b60aa178a7 100644 --- a/source/blender/blenlib/BLI_blenlib.h +++ b/source/blender/blenlib/BLI_blenlib.h @@ -96,6 +96,7 @@ void BLI_make_file_string(const char *relabase, char *string, const char *dir, void BLI_make_exist(char *dir); void BLI_make_existing_file(char *name); void BLI_split_dirfile(const char *string, char *dir, char *file); +void BLI_join_dirfile(char *string, const char *dir, const char *file); int BLI_testextensie(const char *str, const char *ext); void addlisttolist(ListBase *list1, ListBase *list2); void BLI_insertlink(struct ListBase *listbase, void *vprevlink, void *vnewlink); diff --git a/source/blender/blenlib/intern/util.c b/source/blender/blenlib/intern/util.c index ab57b50516f..77ab4d67783 100644 --- a/source/blender/blenlib/intern/util.c +++ b/source/blender/blenlib/intern/util.c @@ -1255,7 +1255,24 @@ void BLI_split_dirfile(const char *string, char *dir, char *file) } #endif } - + +/* simple appending of filename to dir, does not check for valid path! */ +void BLI_join_dirfile(char *string, const char *dir, const char *file) +{ + int sl_dir = strlen(dir); + BLI_strncpy(string, dir, FILE_MAX); + if (sl_dir > FILE_MAX-1) sl_dir = FILE_MAX-1; +#ifdef WIN32 + string[sl_dir] = '\\'; +#else + string[sl_dir] = '/'; +#endif + sl_dir++; + if (sl_dir <FILE_MAX) { + BLI_strncpy(string + sl_dir, file, FILE_MAX-sl_dir); + } +} + static int add_win32_extension(char *name) { int retval = 0; diff --git a/source/blender/python/BPY_menus.c b/source/blender/python/BPY_menus.c index 9b4a5721d4c..580d84aaa3c 100644 --- a/source/blender/python/BPY_menus.c +++ b/source/blender/python/BPY_menus.c @@ -865,14 +865,8 @@ static int bpymenu_ParseDir(char *dirname, char *parentdir, int is_userdir ) s = de->d_name; if (parentdir) { /* Join parentdir and de->d_name */ - short a = strlen(parentdir); - strcpy(subdir, parentdir); - strcpy(subdir + a+1, de->d_name); -#ifdef WIN32 - subdir[a] = '\\'; -#else - subdir[a] = '/'; -#endif + BLI_join_dirfile(subdir, parentdir, de->d_name); + s = subdir; } bpymenu_ParseFile(file, s, is_userdir); @@ -905,7 +899,8 @@ static int bpymenu_ParseDir(char *dirname, char *parentdir, int is_userdir ) } s = de->d_name; if (parentdir) { - BLI_make_file_string(NULL, subdir, parentdir, de->d_name); + /* Join parentdir and de->d_name */ + BLI_join_dirfile(subdir, parentdir, de->d_name); s = subdir; } if (bpymenu_ParseDir(path, s, is_userdir) == -1) { |