fix for own error in r43796, 'Find Missing Files', could set the path to an empty...
[blender.git] / source / blender / blenlib / intern / bpath.c
index f458c158fb23a14599f1b497f8ca4595341916be..ed2684befb15b33dcb435e27fb0a19f3ab5589dc 100644 (file)
@@ -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);