[Bf-blender-cvs] [4102d67d32a] master: Cleanup: avoid use of BLI_cleanup_dir

Campbell Barton noreply at git.blender.org
Fri Mar 6 14:42:04 CET 2020


Commit: 4102d67d32ad2d8411d1ef15e80d3373f36e262b
Author: Campbell Barton
Date:   Sat Mar 7 00:35:55 2020 +1100
Branches: master
https://developer.blender.org/rB4102d67d32ad2d8411d1ef15e80d3373f36e262b

Cleanup: avoid use of BLI_cleanup_dir

Some cases don't need to add the trailing slash.
Use BLI_cleanup_path in this case.

===================================================================

M	source/blender/blenkernel/intern/bpath.c
M	source/blender/blenlib/intern/path_util.c
M	source/blender/blenloader/intern/writefile.c

===================================================================

diff --git a/source/blender/blenkernel/intern/bpath.c b/source/blender/blenkernel/intern/bpath.c
index 38f0e516beb..ef049afc0f3 100644
--- a/source/blender/blenkernel/intern/bpath.c
+++ b/source/blender/blenkernel/intern/bpath.c
@@ -811,7 +811,7 @@ bool BKE_bpath_relocate_visitor(void *pathbase_v, char *path_dst, const char *pa
   BLI_strncpy(filepath, path_src, FILE_MAX);
   if (BLI_path_abs(filepath, base_old)) {
     /* Path was relative and is now absolute. Remap.
-     * Important BLI_cleanup_dir runs before the path is made relative
+     * Important BLI_cleanup_path runs before the path is made relative
      * because it wont work for paths that start with "//../" */
     BLI_cleanup_path(base_new, filepath);
     BLI_path_rel(filepath, base_new);
diff --git a/source/blender/blenlib/intern/path_util.c b/source/blender/blenlib/intern/path_util.c
index 48148fc1134..f5dc5b68107 100644
--- a/source/blender/blenlib/intern/path_util.c
+++ b/source/blender/blenlib/intern/path_util.c
@@ -708,7 +708,7 @@ bool BLI_parent_dir(char *path)
   char tmp[FILE_MAX + 4];
 
   BLI_join_dirfile(tmp, sizeof(tmp), path, parent_dir);
-  BLI_cleanup_dir(NULL, tmp); /* does all the work of normalizing the path for us */
+  BLI_cleanup_path(NULL, tmp); /* does all the work of normalizing the path for us */
 
   if (!BLI_path_extension_check(tmp, parent_dir)) {
     strcpy(path, tmp); /* We assume pardir is always shorter... */
diff --git a/source/blender/blenloader/intern/writefile.c b/source/blender/blenloader/intern/writefile.c
index dece8740789..88fc6a2a930 100644
--- a/source/blender/blenloader/intern/writefile.c
+++ b/source/blender/blenloader/intern/writefile.c
@@ -4096,9 +4096,9 @@ bool BLO_write_file(Main *mainvar,
     BLI_split_dir_part(mainvar->name, dir_src, sizeof(dir_src));
     BLI_split_dir_part(filepath, dir_dst, sizeof(dir_dst));
 
-    /* just in case there is some subtle difference */
-    BLI_cleanup_dir(mainvar->name, dir_dst);
-    BLI_cleanup_dir(mainvar->name, dir_src);
+    /* Just in case there is some subtle difference. */
+    BLI_cleanup_path(mainvar->name, dir_dst);
+    BLI_cleanup_path(mainvar->name, dir_src);
 
     if (G.relbase_valid && (BLI_path_cmp(dir_dst, dir_src) == 0)) {
       /* Saved to same path. Nothing to do. */



More information about the Bf-blender-cvs mailing list