[Bf-blender-cvs] [50c72069b47] master: Cleanup: replace BLI_join_path with BLI_join_string

Campbell Barton noreply at git.blender.org
Thu Nov 3 04:40:53 CET 2022


Commit: 50c72069b475a917769db077f39355755b4c0774
Author: Campbell Barton
Date:   Thu Nov 3 14:35:32 2022 +1100
Branches: master
https://developer.blender.org/rB50c72069b475a917769db077f39355755b4c0774

Cleanup: replace BLI_join_path with BLI_join_string

There is no need to use path joining logic here.

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

M	source/blender/editors/space_file/filelist.cc

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

diff --git a/source/blender/editors/space_file/filelist.cc b/source/blender/editors/space_file/filelist.cc
index 3257534f94d..3870178f119 100644
--- a/source/blender/editors/space_file/filelist.cc
+++ b/source/blender/editors/space_file/filelist.cc
@@ -31,6 +31,7 @@
 #include "BLI_linklist.h"
 #include "BLI_math.h"
 #include "BLI_stack.h"
+#include "BLI_string_utils.h"
 #include "BLI_task.h"
 #include "BLI_threads.h"
 #include "BLI_utildefines.h"
@@ -3542,9 +3543,10 @@ static void filelist_readjob_recursive_dir_add_items(const bool do_lib,
     LISTBASE_FOREACH (FileListInternEntry *, entry, &entries) {
       entry->uid = filelist_uid_generate(filelist);
 
-      /* When loading entries recursive, the rel_path should be relative from the root dir.
-       * we combine the relative path to the subdir with the relative path of the entry. */
-      BLI_path_join(dir, sizeof(dir), rel_subdir, entry->relpath);
+      /* When loading entries recursive, the `rel_path` should be relative from the root dir.
+       * we combine the relative path to the `subdir` with the relative path of the entry.
+       * Using #BLI_path_join works but isn't needed as `rel_subdir` has a trailing slash. */
+      BLI_string_join(dir, sizeof(dir), rel_subdir, entry->relpath);
       MEM_freeN(entry->relpath);
       entry->relpath = BLI_strdup(dir + 2); /* + 2 to remove '//'
                                              * added by BLI_path_rel to rel_subdir. */
@@ -3553,8 +3555,9 @@ static void filelist_readjob_recursive_dir_add_items(const bool do_lib,
 
       if (filelist_readjob_should_recurse_into_entry(
               max_recursion, is_lib, recursion_level, entry)) {
-        /* We have a directory we want to list, add it to todo list! */
-        BLI_path_join(dir, sizeof(dir), root, entry->relpath);
+        /* We have a directory we want to list, add it to todo list!
+         * Using #BLI_path_join works but isn't needed as `root` has a trailing slash. */
+        BLI_string_join(dir, sizeof(dir), root, entry->relpath);
         BLI_path_normalize_dir(job_params->main_name, dir, sizeof(dir));
         td_dir = static_cast<TodoDir *>(BLI_stack_push_r(todo_dirs));
         td_dir->level = recursion_level + 1;



More information about the Bf-blender-cvs mailing list