diff options
author | Campbell Barton <campbell@blender.org> | 2022-01-28 05:59:06 +0300 |
---|---|---|
committer | Campbell Barton <campbell@blender.org> | 2022-01-28 06:50:16 +0300 |
commit | 7475012e24ad02c116ad2dcdcd7b36ca60f62103 (patch) | |
tree | 0604fbf6f8a7e894b9860e8dea17a49a3cfa9156 /source/blender/io/usd | |
parent | f2b24272dd7c8dd0ed13604b082247fda970e069 (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/io/usd')
-rw-r--r-- | source/blender/io/usd/intern/usd_writer_material.cc | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/source/blender/io/usd/intern/usd_writer_material.cc b/source/blender/io/usd/intern/usd_writer_material.cc index 34fd884f51a..af448dc7794 100644 --- a/source/blender/io/usd/intern/usd_writer_material.cc +++ b/source/blender/io/usd/intern/usd_writer_material.cc @@ -397,7 +397,7 @@ static void export_in_memory_texture(Image *ima, return; } - if (BLI_paths_equal(export_path, image_abs_path) && BLI_exists(image_abs_path)) { + if ((BLI_path_cmp_normalized(export_path, image_abs_path) == 0) && BLI_exists(image_abs_path)) { /* As a precaution, don't overwrite the original path. */ return; } @@ -668,7 +668,7 @@ static void copy_tiled_textures(Image *ima, continue; } - if (BLI_paths_equal(src_tile_path, dest_tile_path)) { + if (BLI_path_cmp_normalized(src_tile_path, dest_tile_path) == 0) { /* Source and destination paths are the same, don't copy. */ continue; } @@ -703,7 +703,7 @@ static void copy_single_file(Image *ima, const std::string &dest_dir, const bool return; } - if (BLI_paths_equal(source_path, dest_path)) { + if (BLI_path_cmp_normalized(source_path, dest_path) == 0) { /* Source and destination paths are the same, don't copy. */ return; } |