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:
Diffstat (limited to 'source/blender/blenlib/intern/path_util.c')
-rw-r--r--source/blender/blenlib/intern/path_util.c18
1 files changed, 18 insertions, 0 deletions
diff --git a/source/blender/blenlib/intern/path_util.c b/source/blender/blenlib/intern/path_util.c
index 64bde1193a6..250415c11f9 100644
--- a/source/blender/blenlib/intern/path_util.c
+++ b/source/blender/blenlib/intern/path_util.c
@@ -1829,3 +1829,21 @@ void BLI_path_slash_native(char *path)
BLI_str_replace_char(path + BLI_path_unc_prefix_len(path), ALTSEP, SEP);
#endif
}
+
+bool BLI_paths_equal(const char *p1, const char *p2)
+{
+ /* Normalize the paths so we can compare them. */
+ char norm_p1[FILE_MAX];
+ char norm_p2[FILE_MAX];
+
+ BLI_strncpy(norm_p1, p1, sizeof(norm_p1));
+ BLI_strncpy(norm_p2, p2, sizeof(norm_p2));
+
+ BLI_path_slash_native(norm_p1);
+ BLI_path_slash_native(norm_p2);
+
+ BLI_path_normalize(NULL, norm_p1);
+ BLI_path_normalize(NULL, norm_p2);
+
+ return BLI_path_cmp(norm_p1, norm_p2) == 0;
+}