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:
authorCampbell Barton <campbell@blender.org>2022-01-28 05:59:06 +0300
committerCampbell Barton <campbell@blender.org>2022-01-28 06:50:16 +0300
commit7475012e24ad02c116ad2dcdcd7b36ca60f62103 (patch)
tree0604fbf6f8a7e894b9860e8dea17a49a3cfa9156 /source/blender/blenlib/intern/path_util.c
parentf2b24272dd7c8dd0ed13604b082247fda970e069 (diff)
Cleanup: rename BLI_paths_equal to BLI_path_cmp_normalized
Changes to recent addition: c85c52f2ce478ab0e30c5e93fd5a5cb812db232f. Having both BLI_paths_equal and BLI_path_cmp made it ambiguous which should be used, as `BLI_paths_equal` wasn't the equivalent to `BLI_path_cmp(..) == 0` as it is for string equals macro `STREQ(..)`. It's also a more specialized function which is not used for path comparison throughout Blender's internal path handling logic. Instead rename this `BLI_path_cmp_normalized` and return the result of `BLI_path_cmp` to make it clear paths are modified before comparison. Also add comments about the conventions for Blender's path comparison as well as a possible equivalent to Python's `os.path.samefile` for checking if two paths point to the same location on the file-system.
Diffstat (limited to 'source/blender/blenlib/intern/path_util.c')
-rw-r--r--source/blender/blenlib/intern/path_util.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/source/blender/blenlib/intern/path_util.c b/source/blender/blenlib/intern/path_util.c
index 250415c11f9..65e8c151e8d 100644
--- a/source/blender/blenlib/intern/path_util.c
+++ b/source/blender/blenlib/intern/path_util.c
@@ -1830,7 +1830,7 @@ void BLI_path_slash_native(char *path)
#endif
}
-bool BLI_paths_equal(const char *p1, const char *p2)
+int BLI_path_cmp_normalized(const char *p1, const char *p2)
{
/* Normalize the paths so we can compare them. */
char norm_p1[FILE_MAX];
@@ -1845,5 +1845,5 @@ bool BLI_paths_equal(const char *p1, const char *p2)
BLI_path_normalize(NULL, norm_p1);
BLI_path_normalize(NULL, norm_p2);
- return BLI_path_cmp(norm_p1, norm_p2) == 0;
+ return BLI_path_cmp(norm_p1, norm_p2);
}