From 49942133cc106a3bf12a815a913d8ff3f52fefa0 Mon Sep 17 00:00:00 2001 From: Brecht Van Lommel Date: Thu, 5 Sep 2013 00:37:06 +0000 Subject: Find missing files now keeps relative paths relative instead of turning them into absolute paths. --- source/blender/blenkernel/intern/bpath.c | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'source/blender/blenkernel/intern/bpath.c') diff --git a/source/blender/blenkernel/intern/bpath.c b/source/blender/blenkernel/intern/bpath.c index 4d5107efad7..30dc7514eaf 100644 --- a/source/blender/blenkernel/intern/bpath.c +++ b/source/blender/blenkernel/intern/bpath.c @@ -297,7 +297,14 @@ static bool findMissingFiles_visit_cb(void *userdata, char *path_dst, const char return false; } else { + bool was_relative = BLI_path_is_rel(path_dst); + BLI_strncpy(path_dst, filename_new, FILE_MAX); + + /* keep path relative if the previous one was relative */ + if (was_relative) + BLI_path_rel(path_dst, data->basedir); + return true; } } @@ -307,6 +314,7 @@ void BKE_bpath_missing_files_find(Main *bmain, const char *searchpath, ReportLis { struct BPathFind_Data data = {NULL}; + data.basedir = bmain->name; data.reports = reports; data.searchdir = searchpath; data.find_all = find_all; @@ -330,6 +338,9 @@ static bool rewrite_path_fixed(char *path, BPathVisitor visit_cb, const char *ab path_src = path; } + /* so functions can check old value */ + BLI_strncpy(path_dst, path, FILE_MAX); + if (visit_cb(userdata, path_dst, path_src)) { BLI_strncpy(path, path_dst, FILE_MAX); return true; -- cgit v1.2.3