diff options
author | Campbell Barton <campbell@blender.org> | 2022-09-12 03:10:54 +0300 |
---|---|---|
committer | Campbell Barton <campbell@blender.org> | 2022-09-12 04:02:25 +0300 |
commit | f884a34cae6323327b181ebaa217758cc938fd29 (patch) | |
tree | 85f8749718461d6292c5c9b25c2ef6408d3850f8 /source/blender/blenkernel/intern/packedFile.c | |
parent | cf9c0a4b506e85a4158ec68413c60e8af1de4a0a (diff) |
Cleanup: replace BLI_snprintf with BLI_path_join
Also use a larger buffer to account for the unlikely case of the
buffer not being big enough for the appended directories.
Diffstat (limited to 'source/blender/blenkernel/intern/packedFile.c')
-rw-r--r-- | source/blender/blenkernel/intern/packedFile.c | 36 |
1 files changed, 21 insertions, 15 deletions
diff --git a/source/blender/blenkernel/intern/packedFile.c b/source/blender/blenkernel/intern/packedFile.c index 7c96c463339..901b42ac0b2 100644 --- a/source/blender/blenkernel/intern/packedFile.c +++ b/source/blender/blenkernel/intern/packedFile.c @@ -526,21 +526,27 @@ static void unpack_generate_paths(const char *name, BLI_strncpy(tempdir, "//", sizeof(tempdir)); } - switch (id_type) { - case ID_VF: - BLI_snprintf(r_relpath, relpathlen, "//fonts/%s", tempname); - break; - case ID_SO: - BLI_snprintf(r_relpath, relpathlen, "//sounds/%s", tempname); - break; - case ID_IM: - BLI_snprintf(r_relpath, relpathlen, "//textures/%s", tempname); - break; - case ID_VO: - BLI_snprintf(r_relpath, relpathlen, "//volumes/%s", tempname); - break; - default: - break; + { + const char *dir_name = NULL; + switch (id_type) { + case ID_VF: + dir_name = "fonts"; + break; + case ID_SO: + dir_name = "sounds"; + break; + case ID_IM: + dir_name = "textures"; + break; + case ID_VO: + dir_name = "volumes"; + break; + default: + break; + } + if (dir_name) { + BLI_path_join(r_relpath, relpathlen, "//", dir_name, tempname, NULL); + } } { |