Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSybren A. Stüvel <sybren@blender.org>2021-09-27 16:22:53 +0300
committerSybren A. Stüvel <sybren@blender.org>2021-09-27 19:10:47 +0300
commitaafbe111fc90876d801135f0dc5e01e9742f647a (patch)
treeecaa944881ec81c7dc0b4a134270b283238676a9 /source/blender/blenlib/BLI_path_util.h
parent6578db57cd878a94bdbdabe953c8819625c5a811 (diff)
BLI Path: add function `BLI_path_contains()`
Add function `BLI_path_contains(container, containee)` that returns true if and only `container` contains `containee`. Paths are normalised and converted to native path separators before comparing. Relative paths are *not* made absolute, to simplify the function call; if this is necessary the caller has to do this conversion first.
Diffstat (limited to 'source/blender/blenlib/BLI_path_util.h')
-rw-r--r--source/blender/blenlib/BLI_path_util.h4
1 files changed, 4 insertions, 0 deletions
diff --git a/source/blender/blenlib/BLI_path_util.h b/source/blender/blenlib/BLI_path_util.h
index 2a56d11276a..e4774c58e84 100644
--- a/source/blender/blenlib/BLI_path_util.h
+++ b/source/blender/blenlib/BLI_path_util.h
@@ -55,6 +55,10 @@ bool BLI_path_name_at_index(const char *__restrict path,
int *__restrict r_offset,
int *__restrict r_len) ATTR_NONNULL() ATTR_WARN_UNUSED_RESULT;
+/** Return true only if #containee_path is contained in #container_path. */
+bool BLI_path_contains(const char *container_path,
+ const char *containee_path) ATTR_WARN_UNUSED_RESULT;
+
const char *BLI_path_slash_rfind(const char *string) ATTR_NONNULL() ATTR_WARN_UNUSED_RESULT;
int BLI_path_slash_ensure(char *string) ATTR_NONNULL();
void BLI_path_slash_rstrip(char *string) ATTR_NONNULL();