From d0253b2ea4f3d196d76d3dd7ce6725abd2edc26b Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Wed, 22 Mar 2017 19:31:34 +1100 Subject: BLI_path_util: add BLI_path_name_at_index Utility to get a file/dir in the path by index, supporting negative indices to start from the end of the path. Without this it wasn't straightforward to get the a files parent directory name from a filepath. --- source/blender/blenlib/BLI_path_util.h | 3 +++ 1 file changed, 3 insertions(+) (limited to 'source/blender/blenlib/BLI_path_util.h') diff --git a/source/blender/blenlib/BLI_path_util.h b/source/blender/blenlib/BLI_path_util.h index baa1f792018..7d971fbfc3d 100644 --- a/source/blender/blenlib/BLI_path_util.h +++ b/source/blender/blenlib/BLI_path_util.h @@ -61,6 +61,9 @@ void BLI_path_append(char *__restrict dst, const size_t maxlen, void BLI_join_dirfile(char *__restrict string, const size_t maxlen, const char *__restrict dir, const char *__restrict file) ATTR_NONNULL(); const char *BLI_path_basename(const char *path) ATTR_NONNULL() ATTR_WARN_UNUSED_RESULT; +bool BLI_path_name_at_index( + const char *__restrict path, const int index, + int *__restrict r_offset, int *__restrict r_len) ATTR_NONNULL() ATTR_WARN_UNUSED_RESULT; #if 0 typedef enum bli_rebase_state { -- cgit v1.2.3