From 82fc02fb48e6015373f3c5c1425ffc8b80b16a05 Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Mon, 30 Jul 2012 16:42:26 +0000 Subject: fix for own error in r43796, 'Find Missing Files', could set the path to an empty string. --- source/blender/blenlib/intern/bpath.c | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) (limited to 'source/blender/blenlib') diff --git a/source/blender/blenlib/intern/bpath.c b/source/blender/blenlib/intern/bpath.c index f458c158fb2..ed2684befb1 100644 --- a/source/blender/blenlib/intern/bpath.c +++ b/source/blender/blenlib/intern/bpath.c @@ -191,12 +191,14 @@ void BLI_bpath_absolute_convert(Main *bmain, const char *basedir, ReportList *re data.count_tot, data.count_changed, data.count_failed); } -/* find this file recursively, use the biggest file so thumbnails don't get used by mistake - * - dir: subdir to search - * - filename: set this filename - * - filesize: filesize for the file +/** + * find this file recursively, use the biggest file so thumbnails don't get used by mistake + * \param filename_new: the path will be copied here, caller must initialize as empyu string. + * \param dirname: subdir to search + * \param filename: set this filename + * \param filesize: filesize for the file * - * return found: 1/0. + * \returns found: 1/0. */ #define MAX_RECUR 16 static int findFileRecursive(char *filename_new, @@ -213,8 +215,6 @@ static int findFileRecursive(char *filename_new, int size; int found = FALSE; - filename_new[0] = '\0'; - dir = opendir(dirname); if (dir == NULL) @@ -271,6 +271,8 @@ static int findMissingFiles_visit_cb(void *userdata, char *path_dst, const char int recur_depth = 0; int found; + filename_new[0] = '\0'; + found = findFileRecursive(filename_new, data->searchdir, BLI_path_basename((char *)path_src), &filesize, &recur_depth); -- cgit v1.2.3