diff options
author | Campbell Barton <campbell@blender.org> | 2022-09-12 03:39:24 +0300 |
---|---|---|
committer | Campbell Barton <campbell@blender.org> | 2022-09-12 04:02:25 +0300 |
commit | cf9c0a4b506e85a4158ec68413c60e8af1de4a0a (patch) | |
tree | 1557ceba108b5ef7bba237d25a3eb7cfc23781a4 /source/blender/blenlib/BLI_path_util.h | |
parent | caf6225a3d01b3a5d471dc62bb4508477fc4e7df (diff) |
Tests: add tests for leading (relative) slashes for BLI_path_join
Also note that leading slashes are kept in the doc-string.
Diffstat (limited to 'source/blender/blenlib/BLI_path_util.h')
-rw-r--r-- | source/blender/blenlib/BLI_path_util.h | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/source/blender/blenlib/BLI_path_util.h b/source/blender/blenlib/BLI_path_util.h index 75002f52d94..136258e50f2 100644 --- a/source/blender/blenlib/BLI_path_util.h +++ b/source/blender/blenlib/BLI_path_util.h @@ -84,10 +84,18 @@ void BLI_join_dirfile(char *__restrict dst, * Join multiple strings into a path, ensuring only a single path separator between each, * and trailing slash is kept. * + * \param path: The first patch which has special treatment, + * allowing `//` prefix which is kept intact unlike double-slashes which are stripped + * from the bounds of all other paths passed in. + * Passing in the following paths all result in the same output (`//a/b/c`): + * - `"//", "a", "b", "c"`. + * - `"//", "/a/", "/b/", "/c"`. + * - `"//a", "b/c"`. + * * \note If you want a trailing slash, add `SEP_STR` as the last path argument, * duplicate slashes will be cleaned up. */ -size_t BLI_path_join(char *__restrict dst, size_t dst_len, const char *path_first, ...) +size_t BLI_path_join(char *__restrict dst, size_t dst_len, const char *path, ...) ATTR_NONNULL(1, 3) ATTR_SENTINEL(0); /** * Like Python's `os.path.basename()` |