diff options
author | Campbell Barton <ideasman42@gmail.com> | 2017-03-22 11:31:34 +0300 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2017-03-22 11:34:43 +0300 |
commit | d0253b2ea4f3d196d76d3dd7ce6725abd2edc26b (patch) | |
tree | f1a731e14b1f998901a64a82d4b738e6debc09ea /source/blender/blenlib/BLI_path_util.h | |
parent | 253281f9d6cbfc6bc59238150c3928bffdf887eb (diff) |
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.
Diffstat (limited to 'source/blender/blenlib/BLI_path_util.h')
-rw-r--r-- | source/blender/blenlib/BLI_path_util.h | 3 |
1 files changed, 3 insertions, 0 deletions
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 { |