diff options
author | Campbell Barton <campbell@blender.org> | 2022-10-30 07:44:17 +0300 |
---|---|---|
committer | Campbell Barton <campbell@blender.org> | 2022-10-30 07:56:23 +0300 |
commit | 5392f220f024b59d199dfc40ef4817401f22ee2b (patch) | |
tree | 1dfd1a2a3f3b187ed014b90c04e7b355ae267985 /source/blender/blenlib/BLI_path_util.h | |
parent | d66f24cfe30d26e03863a78de9fd58bb3b65ed43 (diff) |
BLI_path: add BLI_path_append_dir (appends and ensures trailing slash)
Avoid copying the string then calling BLI_path_slash_ensure afterwards.
Diffstat (limited to 'source/blender/blenlib/BLI_path_util.h')
-rw-r--r-- | source/blender/blenlib/BLI_path_util.h | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/source/blender/blenlib/BLI_path_util.h b/source/blender/blenlib/BLI_path_util.h index 9c661178322..6d411b51f85 100644 --- a/source/blender/blenlib/BLI_path_util.h +++ b/source/blender/blenlib/BLI_path_util.h @@ -68,8 +68,15 @@ const char *BLI_path_extension(const char *filepath) ATTR_NONNULL(); /** * Append a filename to a dir, ensuring slash separates. + * \return The new length of `dst`. */ -void BLI_path_append(char *__restrict dst, size_t maxlen, const char *__restrict file) +size_t BLI_path_append(char *__restrict dst, size_t maxlen, const char *__restrict file) + ATTR_NONNULL(); +/** + * A version of #BLI_path_append that ensures a trailing slash if there is space in `dst`. + * \return The new length of `dst`. + */ +size_t BLI_path_append_dir(char *__restrict dst, size_t maxlen, const char *__restrict dir) ATTR_NONNULL(); /** |