Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBastien Montagne <bastien@blender.org>2020-12-15 20:18:53 +0300
committerBastien Montagne <bastien@blender.org>2020-12-15 20:22:22 +0300
commitb24712a9ca6fa807660a02d6988269748daecdbf (patch)
treec4be8ca1da289f141cfface625da166c5a36fac0
parentc6692014cf604a698245158615b4d10b057f12da (diff)
Fix (studio-reported) broken handling of relative font paths.
`blf_dir_search` BLF util would not properly handle relative fonts not found in pre-defined 'system fonts' directoriesi stored in `global_font_dir` global variable. Now it rebases relative paths to current .blend file location as expected. Note: the fact that VSE is setting font ptaths relative by default is probably not actually desired, but this is another issue really. See `BKE_sequencer_text_font_load` code.
-rw-r--r--source/blender/blenfont/intern/blf_dir.c11
1 files changed, 8 insertions, 3 deletions
diff --git a/source/blender/blenfont/intern/blf_dir.c b/source/blender/blenfont/intern/blf_dir.c
index 51d3849aa48..25235097505 100644
--- a/source/blender/blenfont/intern/blf_dir.c
+++ b/source/blender/blenfont/intern/blf_dir.c
@@ -47,6 +47,9 @@
#include "blf_internal.h"
#include "blf_internal_types.h"
+#include "BKE_global.h"
+#include "BKE_main.h"
+
static ListBase global_font_dir = {NULL, NULL};
static DirBLF *blf_dir_find(const char *path)
@@ -137,9 +140,11 @@ char *blf_dir_search(const char *file)
}
if (!s) {
- /* check the current directory, why not ? */
- if (BLI_exists(file)) {
- s = BLI_strdup(file);
+ /* Assume file is either an abslute path, or a relative path to current directory. */
+ BLI_strncpy(full_path, file, sizeof(full_path));
+ BLI_path_abs(full_path, BKE_main_blendfile_path(G_MAIN));
+ if (BLI_exists(full_path)) {
+ s = BLI_strdup(full_path);
}
}