=== 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!
This commit is contained in:
Andrea Weikert 2007-02-28 21:37:14 +00:00
parent a734d3cc27
commit c7ad7cd1b0
3 changed files with 23 additions and 10 deletions

@ -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_exist(char *dir);
void BLI_make_existing_file(char *name); void BLI_make_existing_file(char *name);
void BLI_split_dirfile(const char *string, char *dir, char *file); 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); int BLI_testextensie(const char *str, const char *ext);
void addlisttolist(ListBase *list1, ListBase *list2); void addlisttolist(ListBase *list1, ListBase *list2);
void BLI_insertlink(struct ListBase *listbase, void *vprevlink, void *vnewlink); void BLI_insertlink(struct ListBase *listbase, void *vprevlink, void *vnewlink);

@ -1255,7 +1255,24 @@ void BLI_split_dirfile(const char *string, char *dir, char *file)
} }
#endif #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) static int add_win32_extension(char *name)
{ {
int retval = 0; int retval = 0;

@ -865,14 +865,8 @@ static int bpymenu_ParseDir(char *dirname, char *parentdir, int is_userdir )
s = de->d_name; s = de->d_name;
if (parentdir) { if (parentdir) {
/* Join parentdir and de->d_name */ /* Join parentdir and de->d_name */
short a = strlen(parentdir); BLI_join_dirfile(subdir, parentdir, de->d_name);
strcpy(subdir, parentdir);
strcpy(subdir + a+1, de->d_name);
#ifdef WIN32
subdir[a] = '\\';
#else
subdir[a] = '/';
#endif
s = subdir; s = subdir;
} }
bpymenu_ParseFile(file, s, is_userdir); 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; s = de->d_name;
if (parentdir) { 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; s = subdir;
} }
if (bpymenu_ParseDir(path, s, is_userdir) == -1) { if (bpymenu_ParseDir(path, s, is_userdir) == -1) {