Blender V4.3
bpath.cc
Go to the documentation of this file.
1/* SPDX-FileCopyrightText: 2023 Blender Authors
2 *
3 * SPDX-License-Identifier: GPL-2.0-or-later */
4
9/* TODO:
10 * currently there are some cases we don't support.
11 * - passing output paths to the visitor?, like render out.
12 * - passing sequence strips with many images.
13 * - passing directory paths - visitors don't know which path is a dir or a file.
14 */
15
16#include <sys/stat.h>
17
18#include <cstring>
19
20/* path/file handling stuff */
21#ifndef WIN32
22# include <dirent.h>
23# include <unistd.h>
24#else
25# include "BLI_winstuff.h"
26# include <io.h>
27#endif
28
29#include "MEM_guardedalloc.h"
30
31#include "BLI_fileops.h"
32#include "BLI_path_utils.hh"
33#include "BLI_string.h"
34#include "BLI_utildefines.h"
35
36#include "DEG_depsgraph.hh"
37
38#include "BKE_idtype.hh"
39#include "BKE_main.hh"
40#include "BKE_node.hh"
41#include "BKE_report.hh"
42
43#include "BKE_bpath.hh" /* own include */
44
45#include "CLG_log.h"
46
47#ifndef _MSC_VER
48# include "BLI_strict_flags.h" /* Keep last. */
49#endif
50
51static CLG_LogRef LOG = {"bke.bpath"};
52
53/* -------------------------------------------------------------------- */
57void BKE_bpath_summary_report(const BPathSummary &summary, ReportList *reports)
58{
59 BKE_reportf(reports,
61 "Total files %d | Changed %d | Failed %d",
62 summary.count_total,
63 summary.count_changed,
64 summary.count_failed);
65}
66
69/* -------------------------------------------------------------------- */
74{
75 const eBPathForeachFlag flag = bpath_data->flag;
76 const char *absbase = (flag & BKE_BPATH_FOREACH_PATH_ABSOLUTE) ?
77 ID_BLEND_PATH(bpath_data->bmain, id) :
78 nullptr;
79 bpath_data->absolute_base_path = absbase;
80 bpath_data->owner_id = id;
81 bpath_data->is_path_modified = false;
82
84 return;
85 }
86
87 if (id->library_weak_reference != nullptr &&
89 {
91 id->library_weak_reference->library_filepath,
92 sizeof(id->library_weak_reference->library_filepath));
93 }
94
95 bNodeTree *embedded_node_tree = blender::bke::node_tree_from_id(id);
96 if (embedded_node_tree != nullptr) {
97 BKE_bpath_foreach_path_id(bpath_data, &embedded_node_tree->id);
98 }
99
100 const IDTypeInfo *id_type = BKE_idtype_get_info_from_id(id);
101
102 BLI_assert(id_type != nullptr);
103 if (id_type == nullptr || id_type->foreach_path == nullptr) {
104 return;
105 }
106
107 id_type->foreach_path(id, bpath_data);
108
109 if (bpath_data->is_path_modified) {
111 }
112}
113
115{
116 ID *id;
117 FOREACH_MAIN_ID_BEGIN (bpath_data->bmain, id) {
118 BKE_bpath_foreach_path_id(bpath_data, id);
119 }
121}
122
124 char *path,
125 size_t path_maxncpy)
126{
127 const char *absolute_base_path = bpath_data->absolute_base_path;
128
129 char path_src_buf[FILE_MAX];
130 const char *path_src;
131 char path_dst[FILE_MAX];
132
133 if (absolute_base_path) {
134 STRNCPY(path_src_buf, path);
135 BLI_path_abs(path_src_buf, absolute_base_path);
136 path_src = path_src_buf;
137 }
138 else {
139 path_src = path;
140 }
141
142 /* so functions can check old value */
143 STRNCPY(path_dst, path);
144
145 if (bpath_data->callback_function(bpath_data, path_dst, sizeof(path_dst), path_src)) {
146 BLI_strncpy(path, path_dst, path_maxncpy);
147 bpath_data->is_path_modified = true;
148 return true;
149 }
150
151 return false;
152}
153
155 char *path_dir,
156 size_t path_dir_maxncpy,
157 char *path_file,
158 size_t path_file_maxncpy)
159{
160 const char *absolute_base_path = bpath_data->absolute_base_path;
161
162 char path_src[FILE_MAX];
163 char path_dst[FILE_MAX];
164
165 BLI_path_join(path_src, sizeof(path_src), path_dir, path_file);
166
167 /* So that functions can access the old value. */
168 STRNCPY(path_dst, path_src);
169
170 if (absolute_base_path) {
171 BLI_path_abs(path_src, absolute_base_path);
172 }
173
174 if (bpath_data->callback_function(
175 bpath_data, path_dst, sizeof(path_dst), (const char *)path_src))
176 {
177 BLI_path_split_dir_file(path_dst, path_dir, path_dir_maxncpy, path_file, path_file_maxncpy);
178 bpath_data->is_path_modified = true;
179 return true;
180 }
181
182 return false;
183}
184
186{
187 const char *absolute_base_path = bpath_data->absolute_base_path;
188
189 char path_src_buf[FILE_MAX];
190 const char *path_src;
191 char path_dst[FILE_MAX];
192
193 if (absolute_base_path) {
194 STRNCPY(path_src_buf, *path);
195 BLI_path_abs(path_src_buf, absolute_base_path);
196 path_src = path_src_buf;
197 }
198 else {
199 path_src = *path;
200 }
201
202 if (bpath_data->callback_function(bpath_data, path_dst, sizeof(path_dst), path_src)) {
203 MEM_freeN(*path);
204 (*path) = BLI_strdup(path_dst);
205 bpath_data->is_path_modified = true;
206 return true;
207 }
208
209 return false;
210}
211
214/* -------------------------------------------------------------------- */
219 char * /*path_dst*/,
220 size_t /*path_dst_maxncpy*/,
221 const char *path_src)
222{
223 ReportList *reports = (ReportList *)bpath_data->user_data;
224
225 if (!BLI_exists(path_src)) {
226 ID *owner_id = bpath_data->owner_id;
227 if (owner_id) {
228 if (ID_IS_LINKED(owner_id)) {
229 BKE_reportf(reports,
231 "Path '%s' not found, from linked data-block '%s' (from library '%s')",
232 path_src,
233 owner_id->name,
234 owner_id->lib->runtime.filepath_abs);
235 }
236 else {
237 BKE_reportf(reports,
239 "Path '%s' not found, from local data-block '%s'",
240 path_src,
241 owner_id->name);
242 }
243 }
244 else {
246 reports, RPT_WARNING, "Path '%s' not found (no known owner data-block)", path_src);
247 }
248 }
249
250 return false;
251}
252
254{
255 BPathForeachPathData path_data{};
256 path_data.bmain = bmain;
257 path_data.callback_function = check_missing_files_foreach_path_cb;
260 path_data.user_data = reports;
261 BKE_bpath_foreach_path_main(&path_data);
262
263 if (BLI_listbase_is_empty(&reports->list)) {
264 BKE_reportf(reports, RPT_INFO, "No missing files");
265 }
266}
267
270/* -------------------------------------------------------------------- */
274#define MAX_DIR_RECURSE 16
275#define FILESIZE_INVALID_DIRECTORY -1
276
292static bool missing_files_find__recursive(const char *search_directory,
293 const char *filename_src,
294 char r_filepath_new[FILE_MAX],
295 int64_t *r_filesize,
296 int *r_recurse_depth)
297{
298 /* TODO: Move this function to BLI_path_utils? The 'biggest size' behavior is quite specific
299 * though... */
300 DIR *dir;
301 BLI_stat_t status;
302 char path[FILE_MAX];
304 bool found = false;
305
306 dir = opendir(search_directory);
307
308 if (dir == nullptr) {
309 return found;
310 }
311
312 if (*r_filesize == FILESIZE_INVALID_DIRECTORY) {
313 *r_filesize = 0; /* The directory opened fine. */
314 }
315
316 for (dirent *de = readdir(dir); de != nullptr; de = readdir(dir)) {
317 if (FILENAME_IS_CURRPAR(de->d_name)) {
318 continue;
319 }
320
321 BLI_path_join(path, sizeof(path), search_directory, de->d_name);
322
323 if (BLI_stat(path, &status) == -1) {
324 CLOG_WARN(&LOG, "Cannot get file status (`stat()`) of '%s'", path);
325 continue;
326 }
327
328 if (S_ISREG(status.st_mode)) { /* It is a file. */
329 if (BLI_path_ncmp(filename_src, de->d_name, FILE_MAX) == 0) { /* Names match. */
330 size = status.st_size;
331 if ((size > 0) && (size > *r_filesize)) { /* Find the biggest matching file. */
332 *r_filesize = size;
333 BLI_strncpy(r_filepath_new, path, FILE_MAX);
334 found = true;
335 }
336 }
337 }
338 else if (S_ISDIR(status.st_mode)) { /* It is a sub-directory. */
339 if (*r_recurse_depth <= MAX_DIR_RECURSE) {
340 (*r_recurse_depth)++;
342 path, filename_src, r_filepath_new, r_filesize, r_recurse_depth);
343 (*r_recurse_depth)--;
344 }
345 }
346 }
347
348 closedir(dir);
349 return found;
350}
351
353 const char *basedir;
354 const char *searchdir;
356 bool find_all; /* Also search for files which current path is still valid. */
357};
358
360 char *path_dst,
361 size_t path_dst_maxncpy,
362 const char *path_src)
363{
364 BPathFind_Data *data = (BPathFind_Data *)bpath_data->user_data;
365 char filepath_new[FILE_MAX];
366
368 int recurse_depth = 0;
369 bool is_found;
370
371 if (!data->find_all && BLI_exists(path_src)) {
372 return false;
373 }
374
375 filepath_new[0] = '\0';
376
378 data->searchdir, BLI_path_basename(path_src), filepath_new, &filesize, &recurse_depth);
379
380 if (filesize == FILESIZE_INVALID_DIRECTORY) {
381 BKE_reportf(data->reports,
383 "Could not open the directory '%s'",
384 BLI_path_basename(data->searchdir));
385 return false;
386 }
387 if (is_found == false) {
388 BKE_reportf(data->reports,
390 "Could not find '%s' in '%s'",
391 BLI_path_basename(path_src),
392 data->searchdir);
393 return false;
394 }
395
396 /* Keep the path relative if the previous one was relative. */
397 if (BLI_path_is_rel(path_dst)) {
398 BLI_path_rel(filepath_new, data->basedir);
399 }
400 BLI_strncpy(path_dst, filepath_new, path_dst_maxncpy);
401 return true;
402}
403
405 const char *searchpath,
406 ReportList *reports,
407 const bool find_all)
408{
409 BPathFind_Data data = {nullptr};
412
413 data.basedir = BKE_main_blendfile_path(bmain);
414 data.reports = reports;
415 data.searchdir = searchpath;
416 data.find_all = find_all;
417
418 BPathForeachPathData path_data{};
419 path_data.bmain = bmain;
420 path_data.callback_function = missing_files_find_foreach_path_cb;
421 path_data.flag = eBPathForeachFlag(flag);
422 path_data.user_data = &data;
423 BKE_bpath_foreach_path_main(&path_data);
424}
425
426#undef MAX_DIR_RECURSE
427#undef FILESIZE_INVALID_DIRECTORY
428
431/* -------------------------------------------------------------------- */
442
444 char *path_dst,
445 size_t path_dst_maxncpy,
446 const char *path_src)
447{
448 BPathRebase_Data *data = (BPathRebase_Data *)bpath_data->user_data;
449
450 data->summary.count_total++;
451
452 if (!BLI_path_is_rel(path_src)) {
453 /* Absolute, leave this as-is. */
454 return false;
455 }
456
457 char filepath[(FILE_MAXDIR * 2) + FILE_MAXFILE];
458 BLI_strncpy(filepath, path_src, FILE_MAX);
459 if (!BLI_path_abs(filepath, data->basedir_src)) {
460 BKE_reportf(data->reports, RPT_WARNING, "Path '%s' cannot be made absolute", path_src);
461 data->summary.count_failed++;
462 return false;
463 }
464
465 BLI_path_normalize(filepath);
466
467 /* This may fail, if so it's fine to leave absolute since the path is still valid. */
468 BLI_path_rel(filepath, data->basedir_dst);
469
470 BLI_strncpy(path_dst, filepath, path_dst_maxncpy);
471 data->summary.count_changed++;
472 return true;
473}
474
476 const char *basedir_src,
477 const char *basedir_dst,
478 ReportList *reports,
479 BPathSummary *r_summary)
480{
481 BPathRebase_Data data = {nullptr};
483
484 BLI_assert(basedir_src[0] != '\0');
485 BLI_assert(basedir_dst[0] != '\0');
486
487 data.basedir_src = basedir_src;
488 data.basedir_dst = basedir_dst;
489 data.reports = reports;
490
491 BPathForeachPathData path_data{};
492 path_data.bmain = bmain;
493 path_data.callback_function = relative_rebase_foreach_path_cb;
494 path_data.flag = eBPathForeachFlag(flag);
495 path_data.user_data = &data;
496 BKE_bpath_foreach_path_main(&path_data);
497
498 if (r_summary) {
499 *r_summary = data.summary;
500 }
501}
502
505/* -------------------------------------------------------------------- */
515
517 char *path_dst,
518 size_t path_dst_maxncpy,
519 const char *path_src)
520{
521 BPathRemap_Data *data = (BPathRemap_Data *)bpath_data->user_data;
522
523 data->summary.count_total++;
524
525 if (BLI_path_is_rel(path_src)) {
526 return false; /* Already relative. */
527 }
528
529 char path_test[FILE_MAX];
530 STRNCPY(path_test, path_src);
531
532 BLI_path_rel(path_test, data->basedir);
533 if (!BLI_path_is_rel(path_test)) {
534 const char *type_name = BKE_idtype_get_info_from_id(bpath_data->owner_id)->name;
535 const char *id_name = bpath_data->owner_id->name + 2;
536 BKE_reportf(data->reports,
538 "Path '%s' cannot be made relative for %s '%s'",
539 path_src,
540 type_name,
541 id_name);
542 data->summary.count_failed++;
543 return false;
544 }
545
546 BLI_strncpy(path_dst, path_test, path_dst_maxncpy);
547 data->summary.count_changed++;
548 return true;
549}
550
552 char *path_dst,
553 size_t path_dst_maxncpy,
554 const char *path_src)
555{
556 BPathRemap_Data *data = (BPathRemap_Data *)bpath_data->user_data;
557
558 data->summary.count_total++;
559
560 if (!BLI_path_is_rel(path_src)) {
561 return false; /* Already absolute. */
562 }
563
564 char path_test[FILE_MAX];
565 STRNCPY(path_test, path_src);
566 BLI_path_abs(path_test, data->basedir);
567 if (BLI_path_is_rel(path_test)) {
568 const char *type_name = BKE_idtype_get_info_from_id(bpath_data->owner_id)->name;
569 const char *id_name = bpath_data->owner_id->name + 2;
570 BKE_reportf(data->reports,
572 "Path '%s' cannot be made absolute for %s '%s'",
573 path_src,
574 type_name,
575 id_name);
576 data->summary.count_failed++;
577 return false;
578 }
579
580 BLI_strncpy(path_dst, path_test, path_dst_maxncpy);
581 data->summary.count_changed++;
582 return true;
583}
584
586 const char *basedir,
587 ReportList *reports,
588 BPathForeachPathFunctionCallback callback_function,
589 BPathSummary *r_summary)
590{
591 BPathRemap_Data data = {nullptr};
593
594 BLI_assert(basedir[0] != '\0');
595 if (basedir[0] == '\0') {
596 CLOG_ERROR(&LOG, "basedir='', this is a bug");
597 return;
598 }
599
600 data.basedir = basedir;
601 data.reports = reports;
602
603 BPathForeachPathData path_data{};
604 path_data.bmain = bmain;
605 path_data.callback_function = callback_function;
606 path_data.flag = eBPathForeachFlag(flag);
607 path_data.user_data = &data;
608 BKE_bpath_foreach_path_main(&path_data);
609
610 if (r_summary) {
611 *r_summary = data.summary;
612 }
613}
614
616 const char *basedir,
617 ReportList *reports,
618 BPathSummary *r_summary)
619{
621 bmain, basedir, reports, relative_convert_foreach_path_cb, r_summary);
622}
623
625 const char *basedir,
626 ReportList *reports,
627 BPathSummary *r_summary)
628{
630 bmain, basedir, reports, absolute_convert_foreach_path_cb, r_summary);
631}
632
635/* -------------------------------------------------------------------- */
640struct PathStore {
643 char filepath[0];
644};
645
647 char * /*path_dst*/,
648 size_t /*path_dst_maxncpy*/,
649 const char *path_src)
650{
651 ListBase *path_list = static_cast<ListBase *>(bpath_data->user_data);
652 size_t path_size = strlen(path_src) + 1;
653
654 /* NOTE: the PathStore and its string are allocated together in a single alloc. */
655 PathStore *path_store = static_cast<PathStore *>(
656 MEM_mallocN(sizeof(PathStore) + path_size, __func__));
657
658 char *filepath = path_store->filepath;
659
660 memcpy(filepath, path_src, path_size);
661 BLI_addtail(path_list, path_store);
662 return false;
663}
664
666 char *path_dst,
667 size_t path_dst_maxncpy,
668 const char *path_src)
669{
670 ListBase *path_list = static_cast<ListBase *>(bpath_data->user_data);
671
672 /* `ls->first` should never be nullptr, because the number of paths should not change.
673 * If this happens, there is a bug in caller code. */
675
676 PathStore *path_store = static_cast<PathStore *>(path_list->first);
677 const char *filepath = path_store->filepath;
678 bool is_path_changed = false;
679
680 if (!STREQ(path_src, filepath)) {
681 BLI_strncpy(path_dst, filepath, path_dst_maxncpy);
682 is_path_changed = true;
683 }
684
685 BLI_freelinkN(path_list, path_store);
686 return is_path_changed;
687}
688
690{
691 ListBase *path_list = static_cast<ListBase *>(MEM_callocN(sizeof(ListBase), __func__));
692
693 BPathForeachPathData path_data{};
694 path_data.bmain = bmain;
695 path_data.callback_function = bpath_list_append;
696 path_data.flag = flag;
697 path_data.user_data = path_list;
698 BKE_bpath_foreach_path_main(&path_data);
699
700 return path_list;
701}
702
703void BKE_bpath_list_restore(Main *bmain, const eBPathForeachFlag flag, void *path_list_handle)
704{
705 ListBase *path_list = static_cast<ListBase *>(path_list_handle);
706
707 BPathForeachPathData path_data{};
708 path_data.bmain = bmain;
709 path_data.callback_function = bpath_list_restore;
710 path_data.flag = flag;
711 path_data.user_data = path_list;
712 BKE_bpath_foreach_path_main(&path_data);
713}
714
715void BKE_bpath_list_free(void *path_list_handle)
716{
717 ListBase *path_list = static_cast<ListBase *>(path_list_handle);
718 /* The whole list should have been consumed by #BKE_bpath_list_restore, see also comment in
719 * #bpath_list_restore. */
721
722 BLI_freelistN(path_list);
723 MEM_freeN(path_list);
724}
725
bool(*)(BPathForeachPathData *bpath_data, char *path_dst, size_t path_dst_maxncpy, const char *path_src) BPathForeachPathFunctionCallback
Definition BKE_bpath.hh:78
eBPathForeachFlag
Definition BKE_bpath.hh:26
@ BKE_BPATH_TRAVERSE_SKIP_WEAK_REFERENCES
Definition BKE_bpath.hh:45
@ BKE_BPATH_FOREACH_PATH_SKIP_LINKED
Definition BKE_bpath.hh:35
@ BKE_BPATH_FOREACH_PATH_ABSOLUTE
Definition BKE_bpath.hh:33
@ BKE_BPATH_FOREACH_PATH_SKIP_PACKED
Definition BKE_bpath.hh:37
@ BKE_BPATH_FOREACH_PATH_SKIP_MULTIFILE
Definition BKE_bpath.hh:55
@ BKE_BPATH_FOREACH_PATH_RESOLVE_TOKEN
Definition BKE_bpath.hh:39
@ BKE_BPATH_FOREACH_PATH_RELOAD_EDITED
Definition BKE_bpath.hh:60
const IDTypeInfo * BKE_idtype_get_info_from_id(const ID *id)
Definition idtype.cc:150
#define FOREACH_MAIN_ID_END
Definition BKE_main.hh:500
#define FOREACH_MAIN_ID_BEGIN(_bmain, _id)
Definition BKE_main.hh:494
const char * BKE_main_blendfile_path(const Main *bmain) ATTR_NONNULL()
Definition main.cc:832
void BKE_reportf(ReportList *reports, eReportType type, const char *format,...) ATTR_PRINTF_FORMAT(3
#define BLI_assert(a)
Definition BLI_assert.h:50
File and directory operations.
int BLI_exists(const char *path) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL()
Definition storage.cc:350
int BLI_stat(const char *path, BLI_stat_t *buffer) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL()
struct stat BLI_stat_t
BLI_INLINE bool BLI_listbase_is_empty(const struct ListBase *lb)
void BLI_freelinkN(struct ListBase *listbase, void *vlink) ATTR_NONNULL(1)
Definition listbase.cc:269
void void BLI_freelistN(struct ListBase *listbase) ATTR_NONNULL(1)
Definition listbase.cc:496
void BLI_addtail(struct ListBase *listbase, void *vlink) ATTR_NONNULL(1)
Definition listbase.cc:110
bool BLI_path_abs(char path[FILE_MAX], const char *basepath) ATTR_NONNULL(1
#define BLI_path_ncmp
void void void const char * BLI_path_basename(const char *path) ATTR_NONNULL(1) ATTR_WARN_UNUSED_RESULT
#define FILE_MAXFILE
#define FILE_MAX
int BLI_path_normalize(char *path) ATTR_NONNULL(1)
#define BLI_path_join(...)
#define FILENAME_IS_CURRPAR(_n)
void BLI_path_split_dir_file(const char *filepath, char *dir, size_t dir_maxncpy, char *file, size_t file_maxncpy) ATTR_NONNULL(1
bool BLI_path_is_rel(const char *path) ATTR_NONNULL(1) ATTR_WARN_UNUSED_RESULT
bool void BLI_path_rel(char path[FILE_MAX], const char *basepath) ATTR_NONNULL(1)
#define FILE_MAXDIR
char * BLI_strdup(const char *str) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(1) ATTR_MALLOC
Definition string.c:40
#define STRNCPY(dst, src)
Definition BLI_string.h:593
char * BLI_strncpy(char *__restrict dst, const char *__restrict src, size_t dst_maxncpy) ATTR_NONNULL(1
#define STREQ(a, b)
Compatibility-like things for windows.
struct __dirstream DIR
struct dirent * readdir(DIR *dp)
int closedir(DIR *dp)
#define S_ISDIR(x)
DIR * opendir(const char *path)
#define S_ISREG(x)
#define CLOG_ERROR(clg_ref,...)
Definition CLG_log.h:182
#define CLOG_WARN(clg_ref,...)
Definition CLG_log.h:181
void DEG_id_tag_update(ID *id, unsigned int flags)
@ ID_RECALC_SOURCE
Definition DNA_ID.h:1110
@ ID_RECALC_SYNC_TO_EVAL
Definition DNA_ID.h:1085
#define ID_IS_LINKED(_id)
Definition DNA_ID.h:654
#define ID_BLEND_PATH(_bmain, _id)
Definition DNA_ID.h:647
Read Guarded memory(de)allocation.
static bool bpath_list_restore(BPathForeachPathData *bpath_data, char *path_dst, size_t path_dst_maxncpy, const char *path_src)
Definition bpath.cc:665
static bool missing_files_find_foreach_path_cb(BPathForeachPathData *bpath_data, char *path_dst, size_t path_dst_maxncpy, const char *path_src)
Definition bpath.cc:359
static bool relative_convert_foreach_path_cb(BPathForeachPathData *bpath_data, char *path_dst, size_t path_dst_maxncpy, const char *path_src)
Definition bpath.cc:516
bool BKE_bpath_foreach_path_dirfile_fixed_process(BPathForeachPathData *bpath_data, char *path_dir, size_t path_dir_maxncpy, char *path_file, size_t path_file_maxncpy)
Definition bpath.cc:154
static void bpath_absolute_relative_convert(Main *bmain, const char *basedir, ReportList *reports, BPathForeachPathFunctionCallback callback_function, BPathSummary *r_summary)
Definition bpath.cc:585
#define MAX_DIR_RECURSE
Definition bpath.cc:274
void * BKE_bpath_list_backup(Main *bmain, const eBPathForeachFlag flag)
Definition bpath.cc:689
void BKE_bpath_summary_report(const BPathSummary &summary, ReportList *reports)
Definition bpath.cc:57
bool BKE_bpath_foreach_path_fixed_process(BPathForeachPathData *bpath_data, char *path, size_t path_maxncpy)
Definition bpath.cc:123
void BKE_bpath_relative_rebase(Main *bmain, const char *basedir_src, const char *basedir_dst, ReportList *reports, BPathSummary *r_summary)
Definition bpath.cc:475
void BKE_bpath_list_restore(Main *bmain, const eBPathForeachFlag flag, void *path_list_handle)
Definition bpath.cc:703
void BKE_bpath_foreach_path_id(BPathForeachPathData *bpath_data, ID *id)
Definition bpath.cc:73
void BKE_bpath_relative_convert(Main *bmain, const char *basedir, ReportList *reports, BPathSummary *r_summary)
Definition bpath.cc:615
static bool absolute_convert_foreach_path_cb(BPathForeachPathData *bpath_data, char *path_dst, size_t path_dst_maxncpy, const char *path_src)
Definition bpath.cc:551
static CLG_LogRef LOG
Definition bpath.cc:51
static bool relative_rebase_foreach_path_cb(BPathForeachPathData *bpath_data, char *path_dst, size_t path_dst_maxncpy, const char *path_src)
Definition bpath.cc:443
void BKE_bpath_list_free(void *path_list_handle)
Definition bpath.cc:715
static bool check_missing_files_foreach_path_cb(BPathForeachPathData *bpath_data, char *, size_t, const char *path_src)
Definition bpath.cc:218
#define FILESIZE_INVALID_DIRECTORY
Definition bpath.cc:275
void BKE_bpath_missing_files_check(Main *bmain, ReportList *reports)
Definition bpath.cc:253
bool BKE_bpath_foreach_path_allocated_process(BPathForeachPathData *bpath_data, char **path)
Definition bpath.cc:185
static bool missing_files_find__recursive(const char *search_directory, const char *filename_src, char r_filepath_new[FILE_MAX], int64_t *r_filesize, int *r_recurse_depth)
Definition bpath.cc:292
void BKE_bpath_foreach_path_main(BPathForeachPathData *bpath_data)
Definition bpath.cc:114
static bool bpath_list_append(BPathForeachPathData *bpath_data, char *, size_t, const char *path_src)
Definition bpath.cc:646
void BKE_bpath_absolute_convert(Main *bmain, const char *basedir, ReportList *reports, BPathSummary *r_summary)
Definition bpath.cc:624
void BKE_bpath_missing_files_find(Main *bmain, const char *searchpath, ReportList *reports, const bool find_all)
Definition bpath.cc:404
static DBVT_INLINE btScalar size(const btDbvtVolume &a)
Definition btDbvt.cpp:52
std::string id_name(void *id)
void *(* MEM_mallocN)(size_t len, const char *str)
Definition mallocn.cc:44
void MEM_freeN(void *vmemh)
Definition mallocn.cc:105
void *(* MEM_callocN)(size_t len, const char *str)
Definition mallocn.cc:42
bNodeTree * node_tree_from_id(ID *id)
Definition node.cc:3732
__int64 int64_t
Definition stdint.h:89
const char * searchdir
Definition bpath.cc:354
const char * basedir
Definition bpath.cc:353
ReportList * reports
Definition bpath.cc:355
bool find_all
Definition bpath.cc:356
const char * absolute_base_path
Definition BKE_bpath.hh:96
eBPathForeachFlag flag
Definition BKE_bpath.hh:88
BPathForeachPathFunctionCallback callback_function
Definition BKE_bpath.hh:87
BPathSummary summary
Definition bpath.cc:440
const char * basedir_dst
Definition bpath.cc:437
ReportList * reports
Definition bpath.cc:438
const char * basedir_src
Definition bpath.cc:436
BPathSummary summary
Definition bpath.cc:513
ReportList * reports
Definition bpath.cc:511
const char * basedir
Definition bpath.cc:510
const char * name
IDTypeForeachPathFunction foreach_path
Definition DNA_ID.h:413
struct Library * lib
Definition DNA_ID.h:419
char name[66]
Definition DNA_ID.h:425
char filepath_abs[1024]
Definition DNA_ID.h:509
struct Library_Runtime runtime
Definition DNA_ID.h:535
void * first
PathStore * next
Definition bpath.cc:641
char filepath[0]
Definition bpath.cc:643
PathStore * prev
Definition bpath.cc:641
uint8_t flag
Definition wm_window.cc:138