diff options
author | Brecht Van Lommel <brechtvanlommel@pandora.be> | 2013-09-05 04:37:06 +0400 |
---|---|---|
committer | Brecht Van Lommel <brechtvanlommel@pandora.be> | 2013-09-05 04:37:06 +0400 |
commit | 49942133cc106a3bf12a815a913d8ff3f52fefa0 (patch) | |
tree | fad6f87f030fd0fe69552142a210372bae635cee /source/blender/blenkernel/intern | |
parent | 6d87f2749d963a4cf4bcd3d248f0547f8d3e9907 (diff) |
Find missing files now keeps relative paths relative instead of turning them
into absolute paths.
Diffstat (limited to 'source/blender/blenkernel/intern')
-rw-r--r-- | source/blender/blenkernel/intern/bpath.c | 11 |
1 files changed, 11 insertions, 0 deletions
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; |