[Bf-blender-cvs] [9f6a045e23c] master: Cleanup: replace BLI_join_dirfile with BLI_path_join

Campbell Barton noreply at git.blender.org
Mon Oct 17 02:40:52 CEST 2022


Commit: 9f6a045e23cf4ab132ef78eeaf070bd53d0c509f
Author: Campbell Barton
Date:   Mon Oct 17 11:30:48 2022 +1100
Branches: master
https://developer.blender.org/rB9f6a045e23cf4ab132ef78eeaf070bd53d0c509f

Cleanup: replace BLI_join_dirfile with BLI_path_join

These functions are almost identical, the main difference being
BLI_join_dirfile didn't trim existing slashes when joining paths
however this isn't an important difference that warrants a separate
function.

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

M	intern/mantaflow/intern/MANTA_main.cpp
M	source/blender/blenfont/intern/blf_dir.c
M	source/blender/blenfont/intern/blf_font_default.c
M	source/blender/blenkernel/intern/appdir.c
M	source/blender/blenkernel/intern/asset_catalog.cc
M	source/blender/blenkernel/intern/blender_undo.c
M	source/blender/blenkernel/intern/bpath.c
M	source/blender/blenkernel/intern/image.cc
M	source/blender/blenkernel/intern/modifier.cc
M	source/blender/blenkernel/intern/ocean.c
M	source/blender/blenkernel/intern/pointcache.c
M	source/blender/blenlib/BLI_path_util.h
M	source/blender/blenlib/intern/BLI_filelist.c
M	source/blender/blenlib/intern/fileops.c
M	source/blender/blenlib/intern/path_util.c
M	source/blender/blenloader/intern/versioning_250.c
M	source/blender/blentranslation/intern/blt_lang.c
M	source/blender/compositor/intern/COM_Debug.cc
M	source/blender/compositor/nodes/COM_OutputFileNode.cc
M	source/blender/editors/armature/pose_transform.c
M	source/blender/editors/asset/intern/asset_list.cc
M	source/blender/editors/asset/intern/asset_ops.cc
M	source/blender/editors/interface/interface_icons.c
M	source/blender/editors/interface/interface_ops.cc
M	source/blender/editors/io/io_gpencil_import.c
M	source/blender/editors/io/io_obj.c
M	source/blender/editors/io/io_stl_ops.c
M	source/blender/editors/physics/dynamicpaint_ops.c
M	source/blender/editors/render/render_preview.cc
M	source/blender/editors/screen/workspace_edit.c
M	source/blender/editors/space_clip/clip_ops.c
M	source/blender/editors/space_file/file_draw.c
M	source/blender/editors/space_file/file_ops.c
M	source/blender/editors/space_file/filelist.cc
M	source/blender/editors/space_file/filesel.c
M	source/blender/editors/space_file/fsmenu.c
M	source/blender/editors/space_file/space_file.c
M	source/blender/editors/space_image/image_sequence.c
M	source/blender/editors/space_outliner/outliner_edit.cc
M	source/blender/editors/space_sequencer/sequencer_add.c
M	source/blender/editors/space_sequencer/sequencer_draw.c
M	source/blender/editors/space_sequencer/sequencer_edit.c
M	source/blender/editors/space_view3d/view3d_ops.c
M	source/blender/freestyle/intern/python/BPy_Freestyle.cpp
M	source/blender/imbuf/intern/colormanagement.c
M	source/blender/imbuf/intern/indexer.c
M	source/blender/io/collada/DocumentExporter.cpp
M	source/blender/io/collada/DocumentImporter.cpp
M	source/blender/io/collada/ImageExporter.cpp
M	source/blender/makesrna/intern/rna_sequencer.c
M	source/blender/render/intern/render_result.cc
M	source/blender/sequencer/intern/proxy.c
M	source/blender/sequencer/intern/render.c
M	source/blender/sequencer/intern/strip_add.c
M	source/blender/sequencer/intern/utils.c
M	source/blender/windowmanager/intern/wm_files.c
M	source/blender/windowmanager/intern/wm_files_link.c
M	source/blender/windowmanager/intern/wm_init_exit.c
M	source/blender/windowmanager/intern/wm_platform_support.c
M	source/blender/windowmanager/intern/wm_splash_screen.c
M	source/creator/creator_signals.c

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

diff --git a/intern/mantaflow/intern/MANTA_main.cpp b/intern/mantaflow/intern/MANTA_main.cpp
index ae584e6e590..5708cdc81aa 100644
--- a/intern/mantaflow/intern/MANTA_main.cpp
+++ b/intern/mantaflow/intern/MANTA_main.cpp
@@ -2321,7 +2321,7 @@ string MANTA::getFile(
   char targetFile[FILE_MAX];
   string path = getDirectory(fmd, subdirectory);
   string filename = fname + "_####" + extension;
-  BLI_join_dirfile(targetFile, sizeof(targetFile), path.c_str(), filename.c_str());
+  BLI_path_join(targetFile, sizeof(targetFile), path.c_str(), filename.c_str());
   BLI_path_frame(targetFile, framenr, 0);
   return targetFile;
 }
diff --git a/source/blender/blenfont/intern/blf_dir.c b/source/blender/blenfont/intern/blf_dir.c
index 8534a8c583f..395d981cb0b 100644
--- a/source/blender/blenfont/intern/blf_dir.c
+++ b/source/blender/blenfont/intern/blf_dir.c
@@ -115,7 +115,7 @@ char *blf_dir_search(const char *file)
   char *s = NULL;
 
   for (dir = global_font_dir.first; dir; dir = dir->next) {
-    BLI_join_dirfile(full_path, sizeof(full_path), dir->path, file);
+    BLI_path_join(full_path, sizeof(full_path), dir->path, file);
     if (BLI_exists(full_path)) {
       s = BLI_strdup(full_path);
       break;
diff --git a/source/blender/blenfont/intern/blf_font_default.c b/source/blender/blenfont/intern/blf_font_default.c
index d35692f6eae..63b1cf34db5 100644
--- a/source/blender/blenfont/intern/blf_font_default.c
+++ b/source/blender/blenfont/intern/blf_font_default.c
@@ -32,7 +32,7 @@ static int blf_load_font_default(const char *filename, const bool unique)
   }
 
   char filepath[FILE_MAX];
-  BLI_join_dirfile(filepath, sizeof(filepath), dir, filename);
+  BLI_path_join(filepath, sizeof(filepath), dir, filename);
 
   return (unique) ? BLF_load_unique(filepath) : BLF_load(filepath);
 }
diff --git a/source/blender/blenkernel/intern/appdir.c b/source/blender/blenkernel/intern/appdir.c
index 21750980b53..965f48d1e51 100644
--- a/source/blender/blenkernel/intern/appdir.c
+++ b/source/blender/blenkernel/intern/appdir.c
@@ -954,7 +954,7 @@ bool BKE_appdir_program_python_search(char *fullpath,
     if (python_bin_dir) {
 
       for (int i = 0; i < ARRAY_SIZE(python_names); i++) {
-        BLI_join_dirfile(fullpath, fullpath_len, python_bin_dir, python_names[i]);
+        BLI_path_join(fullpath, fullpath_len, python_bin_dir, python_names[i]);
 
         if (
 #ifdef _WIN32
@@ -1023,7 +1023,7 @@ bool BKE_appdir_app_template_id_search(const char *app_template, char *path, siz
 {
   for (int i = 0; i < ARRAY_SIZE(app_template_directory_id); i++) {
     char subdir[FILE_MAX];
-    BLI_join_dirfile(subdir, sizeof(subdir), app_template_directory_search[i], app_template);
+    BLI_path_join(subdir, sizeof(subdir), app_template_directory_search[i], app_template);
     if (BKE_appdir_folder_id_ex(app_template_directory_id[i], subdir, path, path_len)) {
       return true;
     }
diff --git a/source/blender/blenkernel/intern/asset_catalog.cc b/source/blender/blenkernel/intern/asset_catalog.cc
index cedb0d8b4bf..38c712d7e75 100644
--- a/source/blender/blenkernel/intern/asset_catalog.cc
+++ b/source/blender/blenkernel/intern/asset_catalog.cc
@@ -284,10 +284,10 @@ AssetCatalog *AssetCatalogService::create_catalog(const AssetCatalogPath &catalo
 static std::string asset_definition_default_file_path_from_dir(StringRef asset_library_root)
 {
   char file_path[PATH_MAX];
-  BLI_join_dirfile(file_path,
-                   sizeof(file_path),
-                   asset_library_root.data(),
-                   AssetCatalogService::DEFAULT_CATALOG_FILENAME.data());
+  BLI_path_join(file_path,
+                sizeof(file_path),
+                asset_library_root.data(),
+                AssetCatalogService::DEFAULT_CATALOG_FILENAME.data());
   return file_path;
 }
 
diff --git a/source/blender/blenkernel/intern/blender_undo.c b/source/blender/blenkernel/intern/blender_undo.c
index a5096b4f9eb..f22dfc6054a 100644
--- a/source/blender/blenkernel/intern/blender_undo.c
+++ b/source/blender/blenkernel/intern/blender_undo.c
@@ -116,7 +116,7 @@ MemFileUndoData *BKE_memfile_undo_encode(Main *bmain, MemFileUndoData *mfu_prev)
     counter = counter % U.undosteps;
 
     BLI_snprintf(numstr, sizeof(numstr), "%d.blend", counter);
-    BLI_join_dirfile(filepath, sizeof(filepath), BKE_tempdir_session(), numstr);
+    BLI_path_join(filepath, sizeof(filepath), BKE_tempdir_session(), numstr);
 
     /* success = */ /* UNUSED */ BLO_write_file(
         bmain, filepath, fileflags, &(const struct BlendFileWriteParams){0}, NULL);
diff --git a/source/blender/blenkernel/intern/bpath.c b/source/blender/blenkernel/intern/bpath.c
index f639d03ae0f..6bf121675bc 100644
--- a/source/blender/blenkernel/intern/bpath.c
+++ b/source/blender/blenkernel/intern/bpath.c
@@ -155,7 +155,7 @@ bool BKE_bpath_foreach_path_dirfile_fixed_process(BPathForeachPathData *bpath_da
   char path_src[FILE_MAX];
   char path_dst[FILE_MAX];
 
-  BLI_join_dirfile(path_src, sizeof(path_src), path_dir, path_file);
+  BLI_path_join(path_src, sizeof(path_src), path_dir, path_file);
 
   /* So that functions can access the old value. */
   BLI_strncpy(path_dst, path_src, FILE_MAX);
@@ -279,7 +279,7 @@ static bool missing_files_find__recursive(const char *search_directory,
       continue;
     }
 
-    BLI_join_dirfile(path, sizeof(path), search_directory, de->d_name);
+    BLI_path_join(path, sizeof(path), search_directory, de->d_name);
 
     if (BLI_stat(path, &status) == -1) {
       CLOG_WARN(&LOG, "Cannot get file status (`stat()`) of '%s'", path);
diff --git a/source/blender/blenkernel/intern/image.cc b/source/blender/blenkernel/intern/image.cc
index 409eb0067b5..51d8f02616f 100644
--- a/source/blender/blenkernel/intern/image.cc
+++ b/source/blender/blenkernel/intern/image.cc
@@ -297,7 +297,7 @@ static void image_foreach_path(ID *id, BPathForeachPathData *bpath_data)
       /* Put the filepath back together using the new directory and the original file name. */
       char new_dir[FILE_MAXDIR];
       BLI_split_dir_part(temp_path, new_dir, sizeof(new_dir));
-      BLI_join_dirfile(ima->filepath, sizeof(ima->filepath), new_dir, orig_file);
+      BLI_path_join(ima->filepath, sizeof(ima->filepath), new_dir, orig_file);
     }
   }
   else {
@@ -3331,7 +3331,7 @@ bool BKE_image_get_tile_info(char *filepath, ListBase *tiles, int *r_tile_start,
   MEM_SAFE_FREE(udim_pattern);
 
   if (all_valid_udim && min_udim <= IMA_UDIM_MAX) {
-    BLI_join_dirfile(filepath, FILE_MAX, dirname, filename);
+    BLI_path_join(filepath, FILE_MAX, dirname, filename);
 
     *r_tile_start = min_udim;
     *r_tile_range = max_udim - min_udim + 1;
diff --git a/source/blender/blenkernel/intern/modifier.cc b/source/blender/blenkernel/intern/modifier.cc
index fc1a0f47684..92a7c778b68 100644
--- a/source/blender/blenkernel/intern/modifier.cc
+++ b/source/blender/blenkernel/intern/modifier.cc
@@ -955,7 +955,7 @@ const char *BKE_modifier_path_relbase_from_global(Object *ob)
 void BKE_modifier_path_init(char *path, int path_maxlen, const char *name)
 {
   const char *blendfile_path = BKE_main_blendfile_path_from_global();
-  BLI_join_dirfile(path, path_maxlen, blendfile_path[0] ? "//" : BKE_tempdir_session(), name);
+  BLI_path_join(path, path_maxlen, blendfile_path[0] ? "//" : BKE_tempdir_session(), name);
 }
 
 /**
diff --git a/source/blender/blenkernel/intern/ocean.c b/source/blender/blenkernel/intern/ocean.c
index 396c3443a73..bcf382b6022 100644
--- a/source/blender/blenkernel/intern/ocean.c
+++ b/source/blender/blenkernel/intern/ocean.c
@@ -1144,7 +1144,7 @@ static void cache_filename(
       break;
   }
 
-  BLI_join_dirfile(cachepath, sizeof(cachepath), path, fname);
+  BLI_path_join(cachepath, sizeof(cachepath), path, fname);
 
   BKE_image_path_from_imtype(
       string, cachepath, relbase, frame, R_IMF_IMTYPE_OPENEXR, true, true, "");
diff --git a/source/blender/blenkernel/intern/pointcache.c b/source/blender/blenkernel/intern/pointcache.c
index 5ec69f9bc45..ac98bed2cf0 100644
--- a/source/blender/blenkernel/intern/pointcache.c
+++ b/source/blender/blenkernel/intern/pointcache.c
@@ -2640,7 +2640,7 @@ void BKE_ptcache_id_clear(PTCacheID *pid, int mode, uint cfra)
             if (STREQLEN(filepath, de->d_name, len)) { /* Do we have the right prefix. */
               if (mode == PTCACHE_CLEAR_ALL) {
                 pid->cache->last_exact = MIN2(pid->cache->startframe, 0);
-                BLI_join_dirfile(path_full, sizeof(path_full), path, de->d_name);
+                BLI_path_join(path_full, sizeof(path_full), path, de->d_name);
                 BLI_delete(path_full, false, false);
               }
               else {
@@ -2650,7 +2650,7 @@ void BKE_ptcache_id_clear(PTCacheID *pid, int mode, uint cfra)
                 if (frame != -1) {
                   if ((mode == PTCACHE_CLEAR_BEFORE && frame < cfra) ||
                       (mode == PTCACHE_CLEAR_AFTER && frame > cfra)) {
-                    BLI_join_dirfile(path_full, sizeof(path_full), path, de->d_name);
+                    BLI_path_join(path_full, sizeof(path_full), path, de->d_name);
                     BLI_delete(path_full, false, false);
                     if (pid->cache->cached_frames && frame >= sta && frame <= end) {
                       pid->cache->cached_frames[frame - sta] = 0;
@@ -3524,7 +3524,7 @@ void BKE_ptcache_disk_cache_rename(PTCacheID *pid, const char *name_src, const c
         const int frame = ptcache_frame_from_filename(de->d_name, ext);
 
         if (frame != -1) {
-          BLI_join_dirfile(old_path_full, sizeof(old_path_full), path, de->d_name);
+          BLI_path_join(old_path_full, sizeof(old_path_full), path, de->d_name);
           ptcache_filepath(pid, new_path_full, frame, true, true);
           BLI_rename(old_path_full, new_path_full);
         }
diff --git a/source/blender/blenlib/BLI_path_util.h b/source/blender/blenlib/BLI_path_util.h
index 739b894eafe..4610b71dcd5 100644
--- a/source/blender/blenlib/BLI_path_util.h
+++ b/source/blender/blenlib/BLI_path_util.h
@@ -71,17 +71,7 @@ const char *BLI_path_extension(const char *filepath) ATTR_NONNULL();
  */
 void BLI_path_append(char *__restrict dst, size_t maxlen, const char *__restrict file)
   

@@ Diff output truncated at 10240 characters. @@



More information about the Bf-blender-cvs mailing list