diff options
author | Campbell Barton <campbell@blender.org> | 2022-10-17 03:30:48 +0300 |
---|---|---|
committer | Campbell Barton <campbell@blender.org> | 2022-10-17 03:38:54 +0300 |
commit | 9f6a045e23cf4ab132ef78eeaf070bd53d0c509f (patch) | |
tree | 88f3751a543626217210e45bf88732bf6635148c /source | |
parent | 1d1cade9a9a7f75034669520e39c56959917803a (diff) |
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.
Diffstat (limited to 'source')
60 files changed, 119 insertions, 174 deletions
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) ATTR_NONNULL(); -/** - * Simple appending of filename to dir, does not check for valid path! - * Puts result into `dst`, which may be same area as `dir`. - * - * \note Consider using #BLI_path_join for more general path joining - * that de-duplicates separators and can handle an arbitrary number of paths. - */ -void BLI_join_dirfile(char *__restrict dst, - size_t maxlen, - const char *__restrict dir, - const char *__restrict file) ATTR_NONNULL(); + /** * See #BLI_path_join doc-string. */ diff --git a/source/blender/blenlib/intern/BLI_filelist.c b/source/blender/blenlib/intern/BLI_filelist.c index 1ce6beab933..4bcb023691a 100644 --- a/source/blender/blenlib/intern/BLI_filelist.c +++ b/source/blender/blenlib/intern/BLI_filelist.c @@ -174,7 +174,7 @@ static void bli_builddir(struct BuildDirCtx *dir_ctx, const char *dirname) struct direntry *file = &dir_ctx->files[dir_ctx->files_num]; while (dlink) { char fullname[PATH_MAX]; - BLI_join_dirfile(fullname, sizeof(fullname), dirname, dlink->name); + BLI_path_join(fullname, sizeof(fullname), dirname, dlink->name); memset(file, 0, sizeof(struct direntry)); file->relname = dlink->name; file->path = BLI_strdup(fullname); diff --git a/source/blender/blenlib/intern/fileops.c b/source/blender/blenlib/intern/fileops.c index 3abd482d6b3..a157302e51e 100644 --- a/source/blender/blenlib/intern/fileops.c +++ b/source/blender/blenlib/intern/fileops.c @@ -627,7 +627,7 @@ static void join_dirfile_alloc(char **dst, size_t *alloc_len, const char *dir, c *alloc_len = len; - BLI_join_dirfile(*dst, len + 1, dir, file); + BLI_path_join(*dst, len + 1, dir, file); } static char *strip_last_slash(const char *dir) @@ -1184,7 +1184,7 @@ static const char *check_destination(const char *file, const char *to) len = strlen(to) + strlen(filename) + 1; path = MEM_callocN(len + 1, "check_destination path"); - BLI_join_dirfile(path, len + 1, to, filename); + BLI_path_join(path, len + 1, to, filename); MEM_freeN(str); diff --git a/source/blender/blenlib/intern/path_util.c b/source/blender/blenlib/intern/path_util.c index 0a6e39504df..afe8c3cc033 100644 --- a/source/blender/blenlib/intern/path_util.c +++ b/source/blender/blenlib/intern/path_util.c @@ -625,7 +625,7 @@ bool BLI_path_parent_dir(char *path) const char parent_dir[] = {'.', '.', SEP, '\0'}; /* "../" or "..\\" */ char tmp[FILE_MAX + 4]; - BLI_join_dirfile(tmp, sizeof(tmp), path, parent_dir); + BLI_path_join(tmp, sizeof(tmp), path, parent_dir); BLI_path_normalize(NULL, tmp); /* does all the work of normalizing the path for us */ if (!BLI_path_extension_check(tmp, parent_dir)) { @@ -1025,7 +1025,7 @@ bool BLI_path_abs_from_cwd(char *path, const size_t maxlen) if (BLI_current_working_dir(cwd, sizeof(cwd))) { char origpath[FILE_MAX]; BLI_strncpy(origpath, path, FILE_MAX); - BLI_join_dirfile(path, maxlen, cwd, origpath); + BLI_path_join(path, maxlen, cwd, origpath); } else { printf("Could not get the current working directory - $PWD for an unknown reason.\n"); @@ -1448,48 +1448,6 @@ void BLI_path_append(char *__restrict dst, const size_t maxlen, const char *__re BLI_strncpy(dst + dirlen, file, maxlen - dirlen); } -void BLI_join_dirfile(char *__restrict dst, - const size_t maxlen, - const char *__restrict dir, - const char *__restrict file) -{ -#ifdef DEBUG_STRSIZE - memset(dst, 0xff, sizeof(*dst) * maxlen); -#endif - size_t dirlen = BLI_strnlen(dir, maxlen); - - /* Arguments can't match. */ - BLI_assert(!ELEM(dst, dir, file)); - - /* Files starting with a separator cause a double-slash which could later be interpreted - * as a relative path where: `dir == "/"` and `file == "/file"` would result in "//file". */ - BLI_assert(file[0] != SEP); - - if (dirlen == maxlen) { - memcpy(dst, dir, dirlen); - dst[dirlen - 1] = '\0'; - return; /* dir fills the path */ - } - - memcpy(dst, dir, dirlen + 1); - - if (dirlen + 1 >= maxlen) { - return; /* fills the path */ - } - - /* inline BLI_path_slash_ensure */ - if ((dirlen > 0) && !ELEM(dst[dirlen - 1], SEP, ALTSEP)) { - dst[dirlen++] = SEP; - dst[dirlen] = '\0'; - } - - if (dirlen >= maxlen) { - return; /* fills the path */ - } - - BLI_strncpy(dst + dirlen, file, maxlen - dirlen); -} - size_t BLI_path_join_array(char *__restrict dst, const size_t dst_len, const char *path_array[], diff --git a/source/blender/blenloader/intern/versioning_250.c b/source/blender/blenloader/intern/versioning_250.c index 3a39ed04d2a..0b543ad735b 100644 --- a/source/blender/blenloader/intern/versioning_250.c +++ b/source/blender/blenloader/intern/versioning_250.c @@ -630,7 +630,7 @@ static bool seq_sound_proxy_update_cb(Sequence *seq, void *user_data) Main *bmain = (Main *)user_data; if (seq->type == SEQ_TYPE_SOUND_HD) { char str[FILE_MAX]; - BLI_join_dirfile(str, sizeof(str), seq->strip->dir, seq->strip->stripdata->name); + BLI_path_join(str, sizeof(str), seq->strip->dir, seq->strip->stripdata->name); BLI_path_abs(str, BKE_main_blendfile_path(bmain)); seq->sound = BKE_sound_new_file(bmain, str); } diff --git a/source/blender/blentranslation/intern/blt_lang.c b/source/blender/blentranslation/intern/blt_lang.c index 0662adfb9ed..b8523f289c7 100644 --- a/source/blender/blentranslation/intern/blt_lang.c +++ b/source/blender/blentranslation/intern/blt_lang.c @@ -72,7 +72,7 @@ static void fill_locales(void) free_locales(); - BLI_join_dirfile(languages, FILE_MAX, languages_path, "languages"); + BLI_path_join(languages, FILE_MAX, languages_path, "languages"); line = lines = BLI_file_read_as_lines(languages); /* This whole "parsing" code is a bit weak, in that it expects strictly formatted input file... diff --git a/source/blender/compositor/intern/COM_Debug.cc b/source/blender/compositor/intern/COM_Debug.cc index d0f0be590f6..d184e5540ea 100644 --- a/source/blender/compositor/intern/COM_Debug.cc +++ b/source/blender/compositor/intern/COM_Debug.cc @@ -428,7 +428,7 @@ void DebugInfo::graphviz(const ExecutionSystem *system, StringRefNull name) else { BLI_strncpy(basename, (name + ".dot").c_str(), sizeof(basename)); } - BLI_join_dirfile(filepath, sizeof(filepath), BKE_tempdir_session(), basename); + BLI_path_join(filepath, sizeof(filepath), BKE_tempdir_session(), basename); file_index_++; std::cout << "Writing compositor debug to: " << filepath << "\n"; diff --git a/source/blender/compositor/nodes/COM_OutputFileNode.cc b/source/blender/compositor/nodes/COM_OutputFileNode.cc index c83bcf42efd..fc4270cc222 100644 --- a/source/blender/compositor/nodes/COM_OutputFileNode.cc +++ b/source/blender/compositor/nodes/COM_OutputFileNode.cc @@ -104,7 +104,7 @@ void OutputFileNode::convert_to_operations(NodeConverter &converter, char path[FILE_MAX]; /* combine file path for the input */ - BLI_join_dirfile(path, FILE_MAX, storage->base_path, sockdata->path); + BLI_path_join(path, FILE_MAX, storage->base_path, sockdata->path); NodeOperation *output_operation = nullptr; diff --git a/source/blender/editors/armature/pose_transform.c b/source/blender/editors/armature/pose_transform.c index 2a23615caa3..9ed963f0c66 100644 --- a/source/blender/editors/armature/pose_transform.c +++ b/source/blender/editors/armature/pose_transform.c @@ -788,7 +788,7 @@ static int pose_copy_exec(bContext *C, wmOperator *op) * existing on its own. */ BKE_copybuffer_copy_tag_ID(&ob_copy.id); - BLI_join_dirfile(str, sizeof(str), BKE_tempdir_base(), "copybuffer_pose.blend"); + BLI_path_join(str, sizeof(str), BKE_tempdir_base(), "copybuffer_pose.blend"); BKE_copybuffer_copy_end(temp_bmain, str, op->reports); /* We clear the lists so no datablocks gets freed, * This is required because objects in temp bmain shares same pointers @@ -844,7 +844,7 @@ static int pose_paste_exec(bContext *C, wmOperator *op) Main *tmp_bmain = BKE_main_new(); STRNCPY(tmp_bmain->filepath, BKE_main_blendfile_path_from_global()); - BLI_join_dirfile(str, sizeof(str), BKE_tempdir_base(), "copybuffer_pose.blend"); + BLI_path_join(str, sizeof(str), BKE_tempdir_base(), "copybuffer_pose.blend"); if (!BKE_copybuffer_read(tmp_bmain, str, op->reports, FILTER_ID_OB)) { BKE_report(op->reports, RPT_ERROR, "Copy buffer is empty"); BKE_main_free(tmp_bmain); diff --git a/source/blender/editors/asset/intern/asset_list.cc b/source/blender/editors/asset/intern/asset_list.cc index b0ff5c86520..7fdb924d769 100644 --- a/source/blender/editors/asset/intern/asset_list.cc +++ b/source/blender/editors/asset/intern/asset_list.cc @@ -488,7 +488,7 @@ std::string ED_assetlist_asset_filepath_get(const bContext *C, const char *asset_relpath = asset_handle.file_data->relpath; char path[FILE_MAX_LIBEXTRA]; - BLI_join_dirfile(path, sizeof(path), library_path, asset_relpath); + BLI_path_join(path, sizeof(path), library_path, asset_relpath); return path; } diff --git a/source/blender/editors/asset/intern/asset_ops.cc b/source/blender/editors/asset/intern/asset_ops.cc index 08259090e0c..d1c46a8259f 100644 --- a/source/blender/editors/asset/intern/asset_ops.cc +++ b/source/blender/editors/asset/intern/asset_ops.cc @@ -860,7 +860,7 @@ static bool set_filepath_for_asset_lib(const Main *bmain, struct wmOperator *op) } char file_path[PATH_MAX]; - BLI_join_dirfile(file_path, sizeof(file_path), lib->path, blend_filename); + BLI_path_join(file_path, sizeof(file_path), lib->path, blend_filename); RNA_string_set(op->ptr, "filepath", file_path); return true; diff --git a/source/blender/editors/interface/interface_icons.c b/source/blender/editors/interface/interface_icons.c index c080dce0f08..deb3d84ae66 100644 --- a/source/blender/editors/interface/interface_icons.c +++ b/source/blender/editors/interface/interface_icons.c @@ -923,7 +923,7 @@ static void init_internal_icons(void) char iconfilestr[FILE_MAX]; if (icondir) { - BLI_join_dirfile(iconfilestr, sizeof(iconfilestr), icondir, btheme->tui.iconfile); + BLI_path_join(iconfilestr, sizeof(iconfilestr), icondir, btheme->tui.iconfile); /* if the image is missing bbuf will just be NULL */ bbuf = IMB_loadiffname(iconfilestr, IB_rect, NULL); @@ -1047,7 +1047,7 @@ static void init_iconfile_list(struct ListBase *list) /* check to see if the image is the right size, continue if not */ /* copying strings here should go ok, assuming that we never get back * a complete path to file longer than 256 chars */ - BLI_join_dirfile(iconfilestr, sizeof(iconfilestr), icondir, filename); + BLI_path_join(iconfilestr, sizeof(iconfilestr), icondir, filename); bbuf = IMB_loadiffname(iconfilestr, IB_rect); if (bbuf) { diff --git a/source/blender/editors/interface/interface_ops.cc b/source/blender/editors/interface/interface_ops.cc index 8b29f1075b8..e089642963d 100644 --- a/source/blender/editors/interface/interface_ops.cc +++ b/source/blender/editors/interface/interface_ops.cc @@ -1859,7 +1859,7 @@ static void edittranslation_find_po_file(const char *root, /* First, full lang code. */ BLI_snprintf(tstr, sizeof(tstr), "%s.po", uilng); - BLI_join_dirfile(path, maxlen, root, uilng); + BLI_path_join(path, maxlen, root, uilng); BLI_path_append(path, maxlen, tstr); if (BLI_is_file(path)) { return; @@ -1885,7 +1885,7 @@ static void edittranslation_find_po_file(const char *root, BLI_strncpy(tstr + szt, tc, sizeof(tstr) - szt); } - BLI_join_dirfile(path, maxlen, root, tstr); + BLI_path_join(path, maxlen, root, tstr); strcat(tstr, ".po"); BLI_path_append(path, maxlen, tstr); if (BLI_is_file(path)) { diff --git a/source/blender/editors/io/io_gpencil_import.c b/source/blender/editors/io/io_gpencil_import.c index c7a6b20af7b..5325965e9a5 100644 --- a/source/blender/editors/io/io_gpencil_import.c +++ b/source/blender/editors/io/io_gpencil_import.c @@ -111,7 +111,7 @@ static int wm_gpencil_import_svg_exec(bContext *C, wmOperator *op) char file_path[FILE_MAX]; RNA_PROP_BEGIN (op->ptr, itemptr, prop) { char *filename = RNA_string_get_alloc(&itemptr, "name", NULL, 0, NULL); - BLI_join_dirfile(file_path, sizeof(file_path), directory, filename); + BLI_path_join(file_path, sizeof(file_path), directory, filename); MEM_freeN(filename); /* Do Import. */ diff --git a/source/blender/editors/io/io_obj.c b/source/blender/editors/io/io_obj.c index 7559cd47b27..27994af8fe7 100644 --- a/source/blender/editors/io/io_obj.c +++ b/source/blender/editors/io/io_obj.c @@ -427,8 +427,7 @@ static int wm_obj_import_exec(bContext *C, wmOperator *op) for (int i = 0; i < files_len; i++) { RNA_property_collection_lookup_int(op->ptr, prop, i, &fileptr); RNA_string_get(&fileptr, "name", file_only); - BLI_join_dirfile( - import_params.filepath, sizeof(import_params.filepath), dir_only, file_only); + BLI_path_join(import_params.filepath, sizeof(import_params.filepath), dir_only, file_only); import_params.clear_selection = (i == 0); OBJ_import(C, &import_params); } diff --git a/source/blender/editors/io/io_stl_ops.c b/source/blender/editors/io/io_stl_ops.c index c27d42a07c0..bbdb494e48a 100644 --- a/source/blender/editors/io/io_stl_ops.c +++ b/source/blender/editors/io/io_stl_ops.c @@ -49,7 +49,7 @@ static int wm_stl_import_execute(bContext *C, wmOperator *op) for (int i = 0; i < files_len; i++) { RNA_property_collection_lookup_int(op->ptr, prop, i, &fileptr); RNA_string_get(&fileptr, "name", file_only); - BLI_join_dirfile(params.filepath, sizeof(params.filepath), dir_only, file_only); + BLI_path_join(params.filepath, sizeof(params.filepath), dir_only, file_only); STL_import(C, ¶ms); } } diff --git a/source/blender/editors/physics/dynamicpaint_ops.c b/source/blender/editors/physics/dynamicpaint_ops.c index 1ce90849a88..41238eb171b 100644 --- a/source/blender/editors/physics/dynamicpaint_ops.c +++ b/source/blender/editors/physics/dynamicpaint_ops.c @@ -405,7 +405,7 @@ static void dynamicPaint_bakeImageSequence(DynamicPaintBakeJob *job) /* primary output layer */ if (surface->flags & MOD_DPAINT_OUT1) { /* set filepath */ - BLI_join_dirfile( + BLI_path_join( filepath, sizeof(filepath), surface->image_output_path, surface->output_name); BLI_path_frame(filepath, frame, 4); @@ -415,7 +415,7 @@ static void dynamicPaint_bakeImageSequence(DynamicPaintBakeJob *job) /* secondary output */ if (surface->flags & MOD_DPAINT_OUT2 && surface->type == MOD_DPAINT_SURFACE_T_PAINT) { /* set filepath */ - BLI_join_dirfile( + BLI_path_join( filepath, sizeof(filepath), surface->image_output_path, surface->output_name2); BLI_path_frame(filepath, frame, 4); diff --git a/source/blender/editors/render/render_preview.cc b/source/blender/editors/render/render_preview.cc index ad24f46f923..140199209da 100644 --- a/source/blender/editors/render/render_preview.cc +++ b/source/blender/editors/render/render_preview.cc @@ -1325,7 +1325,7 @@ static ImBuf *icon_preview_imbuf_from_brush(Brush *brush) const char *brushicons_dir = BKE_appdir_folder_id(BLENDER_DATAFILES, "brushicons"); /* Expected to be found, but don't crash if it's not. */ if (brushicons_dir) { - BLI_join_dirfile(filepath, sizeof(filepath), brushicons_dir, brush->icon_filepath); + BLI_path_join(filepath, sizeof(filepath), brushicons_dir, brush->icon_filepath); /* Use default color spaces. */ brush->icon_imbuf = IMB_loadiffname(filepath, flags, nullptr); diff --git a/source/blender/editors/screen/workspace_edit.c b/source/blender/editors/screen/workspace_edit.c index 9a6bdc98d76..8cf11583b3a 100644 --- a/source/blender/editors/screen/workspace_edit.c +++ b/source/blender/editors/screen/workspace_edit.c @@ -405,7 +405,7 @@ static WorkspaceConfigFileData *workspace_config_file_read(const char *app_templ char startup_file_path[FILE_MAX] = {0}; if (cfgdir) { - BLI_join_dirfile(startup_file_path, sizeof(startup_file_path), cfgdir, BLENDER_STARTUP_FILE); + BLI_path_join(startup_file_path, sizeof(startup_file_path), cfgdir, BLENDER_STARTUP_FILE); } bool has_path = BLI_exists(startup_file_path); @@ -425,8 +425,7 @@ static WorkspaceConfigFileData *workspace_system_file_read(const char *app_templ } char startup_file_path[FILE_MAX]; - BLI_join_dirfile( - startup_file_path, sizeof(startup_file_path), template_dir, BLENDER_STARTUP_FILE); + BLI_path_join(startup_file_path, sizeof(startup_file_path), template_dir, BLENDER_STARTUP_FILE); bool has_path = BLI_exists(startup_file_path); return (has_path) ? BKE_blendfile_workspace_config_read(startup_file_path, NULL, 0, NULL) : NULL; diff --git a/source/blender/editors/space_clip/clip_ops.c b/source/blender/editors/space_clip/clip_ops.c index a625c124dd3..486f9f9ccb0 100644 --- a/source/blender/editors/space_clip/clip_ops.c +++ b/source/blender/editors/space_clip/clip_ops.c @@ -201,7 +201,7 @@ static int open_exec(bContext *C, wmOperator *op) RNA_property_collection_lookup_int(op->ptr, prop, 0, &fileptr); RNA_string_get(&fileptr, "name", file_only); - BLI_join_dirfile(str, sizeof(str), dir_only, file_only); + BLI_path_join(str, sizeof(str), dir_only, file_only); } else { BKE_report(op->reports, RPT_ERROR, "No files selected to be opened"); diff --git a/source/blender/editors/space_file/file_draw.c b/source/blender/editors/space_file/file_draw.c index 554b628ba0f..e4085bbe9cc 100644 --- a/source/blender/editors/space_file/file_draw.c +++ b/source/blender/editors/space_file/file_draw.c @@ -544,10 +544,10 @@ static void renamebutton_cb(bContext *C, void *UNUSED(arg1), char *oldname) ARegion *region = CTX_wm_region(C); FileSelectParams *params = ED_fileselect_get_active_params(sfile); - BLI_join_dirfile(orgname, sizeof(orgname), params->dir, oldname); + BLI_path_join(orgname, sizeof(orgname), params->dir, oldname); BLI_strncpy(filename, params->renamefile, sizeof(filename)); BLI_filename_make_safe(filename); - BLI_join_dirfile(newname, sizeof(newname), params->dir, filename); + BLI_path_join(newname, sizeof(newname), params->dir, filename); if (!STREQ(orgname, newname)) { if (!BLI_exists(newname)) { @@ -952,7 +952,7 @@ void file_draw_list(const bContext *C, ARegion *region) file = filelist_file(files, i); file_selflag = filelist_entry_select_get(sfile->files, file, CHECK_ALL); - BLI_join_dirfile(path, sizeof(path), root, file->relpath); + BLI_path_join(path, sizeof(path), root, file->relpath); if (!(file_selflag & FILE_SEL_EDITING)) { if ((params->highlight_file == i) || (file_selflag & FILE_SEL_HIGHLIGHTED) || diff --git a/source/blender/editors/space_file/file_ops.c b/source/blender/editors/space_file/file_ops.c index 63aa71e9855..a4d4bf98474 100644 --- a/source/blender/editors/space_file/file_ops.c +++ b/source/blender/editors/space_file/file_ops.c @@ -386,7 +386,7 @@ static bool fsmenu_write_file_and_refresh_or_report_error(struct FSMenu *fsmenu, } char filepath[FILE_MAX]; - BLI_join_dirfile(filepath, sizeof(filepath), cfgdir, BLENDER_BOOKMARK_FILE); + BLI_path_join(filepath, sizeof(filepath), cfgdir, BLENDER_BOOKMARK_FILE); if (UNLIKELY(!fsmenu_write_file(fsmenu, filepath))) { BKE_reportf(reports, RPT_ERROR, "Unable to open or write bookmark file \"%s\"", filepath); return false; @@ -1564,7 +1564,7 @@ void file_sfile_to_operator_ex( PropertyRNA *prop; /* XXX, not real length */ - BLI_join_dirfile(filepath, FILE_MAX, params->dir, params->file); + BLI_path_join(filepath, FILE_MAX, params->dir, params->file); if ((prop = RNA_struct_find_property(op->ptr, "relative_path"))) { if (RNA_property_boolean_get(op->ptr, prop)) { @@ -1741,7 +1741,7 @@ bool file_draw_check_exists(SpaceFile *sfile) const FileSelectParams *params = ED_fileselect_get_active_params(sfile); if (params && (params->flag & FILE_CHECK_EXISTING)) { char filepath[FILE_MAX]; - BLI_join_dirfile(filepath, sizeof(filepath), params->dir, params->file); + BLI_path_join(filepath, sizeof(filepath), params->dir, params->file); if (BLI_is_file(filepath)) { return true; } @@ -2311,13 +2311,13 @@ static bool new_folder_path(const char *parent, char folder[FILE_MAX], char name int len = 0; BLI_strncpy(name, "New Folder", FILE_MAXFILE); - BLI_join_dirfile(folder, FILE_MAX, parent, name); + BLI_path_join(folder, FILE_MAX, parent, name); /* check whether folder with the name already exists, in this case * add number to the name. Check length of generated name to avoid * crazy case of huge number of folders each named 'New Folder (x)' */ while (BLI_exists(folder) && (len < FILE_MAXFILE)) { len = BLI_snprintf(name, FILE_MAXFILE, "New Folder(%d)", i); - BLI_join_dirfile(folder, FILE_MAX, parent, name); + BLI_path_join(folder, FILE_MAX, parent, name); i++; } @@ -2621,7 +2621,7 @@ void file_filename_enter_handle(bContext *C, void *UNUSED(arg_unused), void *arg } if (matches == 1) { - BLI_join_dirfile(filepath, sizeof(params->dir), params->dir, params->file); + BLI_path_join(filepath, sizeof(params->dir), params->dir, params->file); /* if directory, open it and empty filename field */ if (filelist_is_dir(sfile->files, filepath)) { @@ -2849,7 +2849,7 @@ static bool file_delete_single(const FileSelectParams *params, const char **r_error_message) { char str[FILE_MAX]; - BLI_join_dirfile(str, sizeof(str), params->dir, file->relpath); + BLI_path_join(str, sizeof(str), params->dir, file->relpath); if (BLI_delete_soft(str, r_error_message) != 0 || BLI_exists(str)) { return false; } diff --git a/source/blender/editors/space_file/filelist.cc b/source/blender/editors/space_file/filelist.cc index c2dc8e9196d..b6f6ab39438 100644 --- a/source/blender/editors/space_file/filelist.cc +++ b/source/blender/editors/space_file/filelist.cc @@ -844,7 +844,7 @@ static bool is_filtered_lib_type(FileListInternEntry *file, { char path[FILE_MAX_LIBEXTRA], dir[FILE_MAX_LIBEXTRA], *group, *name; - BLI_join_dirfile(path, sizeof(path), root, file->relpath); + BLI_path_join(path, sizeof(path), root, file->relpath); if (BLO_library_path_explode(path, dir, &group, &name)) { return is_filtered_id_file_type(file, group, name, filter); @@ -1204,7 +1204,7 @@ static int filelist_geticon_ex(const FileDirEntry *file, target = file->redirection_path; } else if (root) { - BLI_join_dirfile(fullpath, sizeof(fullpath), root, file->relpath); + BLI_path_join(fullpath, sizeof(fullpath), root, file->relpath); BLI_path_slash_ensure(fullpath); } for (; tfsm; tfsm = tfsm->next) { @@ -1606,7 +1606,7 @@ static void filelist_cache_previews_push(FileList *filelist, FileDirEntry *entry BLI_strncpy(preview->filepath, entry->redirection_path, FILE_MAXDIR); } else { - BLI_join_dirfile( + BLI_path_join( preview->filepath, sizeof(preview->filepath), filelist->filelist.root, entry->relpath); } // printf("%s: %d - %s\n", __func__, preview->index, preview->filepath); @@ -1894,7 +1894,7 @@ static char *fileentry_uiname(const char *root, if (typeflag & FILE_TYPE_FTFONT && !(typeflag & FILE_TYPE_BLENDERLIB)) { char abspath[FILE_MAX_LIBEXTRA]; - BLI_join_dirfile(abspath, sizeof(abspath), root, relpath); + BLI_path_join(abspath, sizeof(abspath), root, relpath); name = BLF_display_name_from_file(abspath); if (name) { /* Allocated string, so no need to #BLI_strdup. */ @@ -1906,7 +1906,7 @@ static char *fileentry_uiname(const char *root, char abspath[FILE_MAX_LIBEXTRA]; char *group; - BLI_join_dirfile(abspath, sizeof(abspath), root, relpath); + BLI_path_join(abspath, sizeof(abspath), root, relpath); BLO_library_path_explode(abspath, buff, &group, &name); if (!name) { name = group; @@ -2887,7 +2887,7 @@ static int filelist_readjob_list_dir(const char *root, entry->relpath = static_cast<char *>(MEM_dupallocN(files[i].relname)); entry->st = files[i].s; - BLI_join_dirfile(full_path, FILE_MAX, root, entry->relpath); + BLI_path_join(full_path, FILE_MAX, root, entry->relpath); char *target = full_path; /* Set initial file type and attributes. */ @@ -3525,7 +3525,7 @@ static void filelist_readjob_recursive_dir_add_items(const bool do_lib, /* 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_join_dirfile(dir, sizeof(dir), rel_subdir, entry->relpath); + BLI_path_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. */ @@ -3535,7 +3535,7 @@ 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_join_dirfile(dir, sizeof(dir), root, entry->relpath); + BLI_path_join(dir, sizeof(dir), root, entry->relpath); BLI_path_normalize_dir(job_params->main_name, dir); td_dir = static_cast<TodoDir *>(BLI_stack_push_r(todo_dirs)); td_dir->level = recursion_level + 1; diff --git a/source/blender/editors/space_file/filesel.c b/source/blender/editors/space_file/filesel.c index 9ebc4872544..df7e9702e85 100644 --- a/source/blender/editors/space_file/filesel.c +++ b/source/blender/editors/space_file/filesel.c @@ -1174,7 +1174,7 @@ int autocomplete_directory(struct bContext *C, char *str, void *UNUSED(arg_v)) char path[FILE_MAX]; BLI_stat_t status; - BLI_join_dirfile(path, sizeof(path), dirname, de->d_name); + BLI_path_join(path, sizeof(path), dirname, de->d_name); if (BLI_stat(path, &status) == 0) { if (S_ISDIR(status.st_mode)) { /* is subdir */ diff --git a/source/blender/editors/space_file/fsmenu.c b/source/blender/editors/space_file/fsmenu.c index a6c5e0f1734..cea53908d4f 100644 --- a/source/blender/editors/space_file/fsmenu.c +++ b/source/blender/editors/space_file/fsmenu.c @@ -254,10 +254,10 @@ void ED_fsmenu_entry_set_path(struct FSMenuEntry *fsentry, const char *path) fsentry->path = (path && path[0]) ? BLI_strdup(path) : NULL; - BLI_join_dirfile(tmp_name, - sizeof(tmp_name), - BKE_appdir_folder_id_create(BLENDER_USER_CONFIG, NULL), - BLENDER_BOOKMARK_FILE); + BLI_path_join(tmp_name, + sizeof(tmp_name), + BKE_appdir_folder_id_create(BLENDER_USER_CONFIG, NULL), + BLENDER_BOOKMARK_FILE); fsmenu_write_file(ED_fsmenu_get(), tmp_name); } } @@ -318,10 +318,10 @@ void ED_fsmenu_entry_set_name(struct FSMenuEntry *fsentry, const char *name) BLI_strncpy(fsentry->name, name, sizeof(fsentry->name)); } - BLI_join_dirfile(tmp_name, - sizeof(tmp_name), - BKE_appdir_folder_id_create(BLENDER_USER_CONFIG, NULL), - BLENDER_BOOKMARK_FILE); + BLI_path_join(tmp_name, + sizeof(tmp_name), + BKE_appdir_folder_id_create(BLENDER_USER_CONFIG, NULL), + BLENDER_BOOKMARK_FILE); fsmenu_write_file(ED_fsmenu_get(), tmp_name); } } @@ -983,7 +983,7 @@ void fsmenu_read_system(struct FSMenu *fsmenu, int read_bookmarks) if (xdg_runtime_dir != NULL) { struct direntry *dirs; char name[FILE_MAX]; - BLI_join_dirfile(name, sizeof(name), xdg_runtime_dir, "gvfs/"); + BLI_path_join(name, sizeof(name), xdg_runtime_dir, "gvfs/"); const uint dirs_num = BLI_filelist_dir_contents(name, &dirs); for (uint i = 0; i < dirs_num; i++) { if (dirs[i].type & S_IFDIR) { diff --git a/source/blender/editors/space_file/space_file.c b/source/blender/editors/space_file/space_file.c index a3182222263..74f1b8e838a 100644 --- a/source/blender/editors/space_file/space_file.c +++ b/source/blender/editors/space_file/space_file.c @@ -1157,7 +1157,7 @@ void ED_file_read_bookmarks(void) if (cfgdir) { char name[FILE_MAX]; - BLI_join_dirfile(name, sizeof(name), cfgdir, BLENDER_BOOKMARK_FILE); + BLI_path_join(name, sizeof(name), cfgdir, BLENDER_BOOKMARK_FILE); fsmenu_read_bookmarks(ED_fsmenu_get(), name); } } diff --git a/source/blender/editors/space_image/image_sequence.c b/source/blender/editors/space_image/image_sequence.c index 7108c258665..d2725652979 100644 --- a/source/blender/editors/space_image/image_sequence.c +++ b/source/blender/editors/space_image/image_sequence.c @@ -62,14 +62,14 @@ static void image_sequence_get_frame_ranges(wmOperator *op, ListBase *ranges) STREQLEN(base_tail, tail, FILE_MAX)) { /* Set filepath to first frame in the range. */ if (frame->framenr < range_first_frame) { - BLI_join_dirfile(range->filepath, sizeof(range->filepath), dir, filename); + BLI_path_join(range->filepath, sizeof(range->filepath), dir, filename); range_first_frame = frame->framenr; } } else { /* start a new frame range */ range = MEM_callocN(sizeof(*range), __func__); - BLI_join_dirfile(range->filepath, sizeof(range->filepath), dir, filename); + BLI_path_join(range->filepath, sizeof(range->filepath), dir, filename); BLI_addtail(ranges, range); BLI_strncpy(base_head, head, sizeof(base_head)); diff --git a/source/blender/editors/space_outliner/outliner_edit.cc b/source/blender/editors/space_outliner/outliner_edit.cc index 6eca6fffece..9a6a25fdbae 100644 --- a/source/blender/editors/space_outliner/outliner_edit.cc +++ b/source/blender/editors/space_outliner/outliner_edit.cc @@ -809,7 +809,7 @@ static int outliner_id_copy_exec(bContext *C, wmOperator *op) return OPERATOR_CANCELLED; } - BLI_join_dirfile(str, sizeof(str), BKE_tempdir_base(), "copybuffer.blend"); + BLI_path_join(str, sizeof(str), BKE_tempdir_base(), "copybuffer.blend"); BKE_copybuffer_copy_end(bmain, str, op->reports); BKE_reportf(op->reports, RPT_INFO, "Copied %d selected data-block(s)", num_ids); @@ -843,7 +843,7 @@ static int outliner_id_paste_exec(bContext *C, wmOperator *op) char str[FILE_MAX]; const short flag = FILE_AUTOSELECT | FILE_ACTIVE_COLLECTION; - BLI_join_dirfile(str, sizeof(str), BKE_tempdir_base(), "copybuffer.blend"); + BLI_path_join(str, sizeof(str), BKE_tempdir_base(), "copybuffer.blend"); const int num_pasted = BKE_copybuffer_paste(C, str, flag, op->reports, 0); if (num_pasted == 0) { diff --git a/source/blender/editors/space_sequencer/sequencer_add.c b/source/blender/editors/space_sequencer/sequencer_add.c index 6ef8d7fd108..b17d0bfac4e 100644 --- a/source/blender/editors/space_sequencer/sequencer_add.c +++ b/source/blender/editors/space_sequencer/sequencer_add.c @@ -274,7 +274,7 @@ static void load_data_init_from_operator(SeqLoadData *load_data, bContext *C, wm RNA_PROP_BEGIN (op->ptr, itemptr, prop) { char *filename = RNA_string_get_alloc(&itemptr, "name", NULL, 0, NULL); BLI_strncpy(load_data->name, filename, sizeof(load_data->name)); - BLI_join_dirfile(load_data->path, sizeof(load_data->path), directory, filename); + BLI_path_join(load_data->path, sizeof(load_data->path), directory, filename); MEM_freeN(filename); break; } @@ -834,7 +834,7 @@ static void sequencer_add_movie_multiple_strips(bContext *C, char file_only[FILE_MAX]; RNA_string_get(op->ptr, "directory", dir_only); RNA_string_get(&itemptr, "name", file_only); - BLI_join_dirfile(load_data->path, sizeof(load_data->path), dir_only, file_only); + BLI_path_join(load_data->path, sizeof(load_data->path), dir_only, file_only); BLI_strncpy(load_data->name, file_only, sizeof(load_data->name)); Sequence *seq_movie = NULL; Sequence *seq_sound = NULL; @@ -1082,7 +1082,7 @@ static void sequencer_add_sound_multiple_strips(bContext *C, char file_only[FILE_MAX]; RNA_string_get(op->ptr, "directory", dir_only); RNA_string_get(&itemptr, "name", file_only); - BLI_join_dirfile(load_data->path, sizeof(load_data->path), dir_only, file_only); + BLI_path_join(load_data->path, sizeof(load_data->path), dir_only, file_only); BLI_strncpy(load_data->name, file_only, sizeof(load_data->name)); Sequence *seq = SEQ_add_sound_strip(bmain, scene, ed->seqbasep, load_data); if (seq == NULL) { diff --git a/source/blender/editors/space_sequencer/sequencer_draw.c b/source/blender/editors/space_sequencer/sequencer_draw.c index 201425dafab..a6916f9d031 100644 --- a/source/blender/editors/space_sequencer/sequencer_draw.c +++ b/source/blender/editors/space_sequencer/sequencer_draw.c @@ -804,7 +804,7 @@ static void draw_seq_text_get_source(Sequence *seq, char *r_source, size_t sourc switch (seq->type) { case SEQ_TYPE_IMAGE: case SEQ_TYPE_MOVIE: { - BLI_join_dirfile(r_source, source_len, seq->strip->dir, seq->strip->stripdata->name); + BLI_path_join(r_source, source_len, seq->strip->dir, seq->strip->stripdata->name); break; } case SEQ_TYPE_SOUND_RAM: { diff --git a/source/blender/editors/space_sequencer/sequencer_edit.c b/source/blender/editors/space_sequencer/sequencer_edit.c index 2938513f130..c0c7782c60c 100644 --- a/source/blender/editors/space_sequencer/sequencer_edit.c +++ b/source/blender/editors/space_sequencer/sequencer_edit.c @@ -2939,7 +2939,7 @@ static int sequencer_change_path_invoke(bContext *C, wmOperator *op, const wmEve Sequence *seq = SEQ_select_active_get(scene); char filepath[FILE_MAX]; - BLI_join_dirfile(filepath, sizeof(filepath), seq->strip->dir, seq->strip->stripdata->name); + BLI_path_join(filepath, sizeof(filepath), seq->strip->dir, seq->strip->stripdata->name); RNA_string_set(op->ptr, "directory", seq->strip->dir); RNA_string_set(op->ptr, "filepath", filepath); diff --git a/source/blender/editors/space_view3d/view3d_ops.c b/source/blender/editors/space_view3d/view3d_ops.c index 6fbd553e17b..ad12aef6d67 100644 --- a/source/blender/editors/space_view3d/view3d_ops.c +++ b/source/blender/editors/space_view3d/view3d_ops.c @@ -59,7 +59,7 @@ static int view3d_copybuffer_exec(bContext *C, wmOperator *op) } CTX_DATA_END; - BLI_join_dirfile(str, sizeof(str), BKE_tempdir_base(), "copybuffer.blend"); + BLI_path_join(str, sizeof(str), BKE_tempdir_base(), "copybuffer.blend"); BKE_copybuffer_copy_end(bmain, str, op->reports); BKE_reportf(op->reports, RPT_INFO, "Copied %d selected object(s)", num_copied); @@ -91,7 +91,7 @@ static int view3d_pastebuffer_exec(bContext *C, wmOperator *op) flag |= FILE_ACTIVE_COLLECTION; } - BLI_join_dirfile(str, sizeof(str), BKE_tempdir_base(), "copybuffer.blend"); + BLI_path_join(str, sizeof(str), BKE_tempdir_base(), "copybuffer.blend"); const int num_pasted = BKE_copybuffer_paste(C, str, flag, op->reports, FILTER_ID_OB); if (num_pasted == 0) { diff --git a/source/blender/freestyle/intern/python/BPy_Freestyle.cpp b/source/blender/freestyle/intern/python/BPy_Freestyle.cpp index 96887f7a83b..237f1802026 100644 --- a/source/blender/freestyle/intern/python/BPy_Freestyle.cpp +++ b/source/blender/freestyle/intern/python/BPy_Freestyle.cpp @@ -531,7 +531,7 @@ PyObject *Freestyle_Init(void) const char *const path = BKE_appdir_folder_id(BLENDER_SYSTEM_SCRIPTS, "freestyle"); if (path) { char modpath[FILE_MAX]; - BLI_join_dirfile(modpath, sizeof(modpath), path, "modules"); + BLI_path_join(modpath, sizeof(modpath), path, "modules"); PyObject *sys_path = PySys_GetObject("path"); /* borrow */ PyObject *py_modpath = PyUnicode_FromString(modpath); PyList_Append(sys_path, py_modpath); diff --git a/source/blender/imbuf/intern/colormanagement.c b/source/blender/imbuf/intern/colormanagement.c index ea5f4ec275d..5e132826a4c 100644 --- a/source/blender/imbuf/intern/colormanagement.c +++ b/source/blender/imbuf/intern/colormanagement.c @@ -668,7 +668,7 @@ void colormanagement_init(void) configdir = BKE_appdir_folder_id(BLENDER_DATAFILES, "colormanagement"); if (configdir) { - BLI_join_dirfile(configfile, sizeof(configfile), configdir, BCM_CONFIG_FILE); + BLI_path_join(configfile, sizeof(configfile), configdir, BCM_CONFIG_FILE); #ifdef WIN32 { diff --git a/source/blender/imbuf/intern/indexer.c b/source/blender/imbuf/intern/indexer.c index 735472b6bdf..8965700c08a 100644 --- a/source/blender/imbuf/intern/indexer.c +++ b/source/blender/imbuf/intern/indexer.c @@ -426,7 +426,7 @@ static bool get_proxy_filepath(struct anim *anim, return false; } - BLI_join_dirfile(filepath, FILE_MAXFILE + FILE_MAXDIR, index_dir, proxy_name); + BLI_path_join(filepath, FILE_MAXFILE + FILE_MAXDIR, index_dir, proxy_name); return true; } @@ -457,7 +457,7 @@ static void get_tc_filename(struct anim *anim, IMB_Timecode_Type tc, char *filep get_index_dir(anim, index_dir, sizeof(index_dir)); - BLI_join_dirfile(filepath, FILE_MAXFILE + FILE_MAXDIR, index_dir, index_name); + BLI_path_join(filepath, FILE_MAXFILE + FILE_MAXDIR, index_dir, index_name); } /* ---------------------------------------------------------------------- diff --git a/source/blender/io/collada/DocumentExporter.cpp b/source/blender/io/collada/DocumentExporter.cpp index 56adbca13bd..07392e9c4ce 100644 --- a/source/blender/io/collada/DocumentExporter.cpp +++ b/source/blender/io/collada/DocumentExporter.cpp @@ -145,7 +145,7 @@ static COLLADABU::NativeString make_temp_filepath(const char *name, const char * name = "untitled"; } - BLI_join_dirfile(tempfile, sizeof(tempfile), BKE_tempdir_session(), name); + BLI_path_join(tempfile, sizeof(tempfile), BKE_tempdir_session(), name); if (extension) { BLI_path_extension_ensure(tempfile, FILE_MAX, extension); diff --git a/source/blender/io/collada/DocumentImporter.cpp b/source/blender/io/collada/DocumentImporter.cpp index 660bbd7edb2..5e432682564 100644 --- a/source/blender/io/collada/DocumentImporter.cpp +++ b/source/blender/io/collada/DocumentImporter.cpp @@ -937,7 +937,7 @@ bool DocumentImporter::writeImage(const COLLADAFW::Image *image) const char *workpath; BLI_split_dir_part(this->import_settings->filepath, dir, sizeof(dir)); - BLI_join_dirfile(absolute_path, sizeof(absolute_path), dir, imagepath.c_str()); + BLI_path_join(absolute_path, sizeof(absolute_path), dir, imagepath.c_str()); if (BLI_exists(absolute_path)) { workpath = absolute_path; } diff --git a/source/blender/io/collada/ImageExporter.cpp b/source/blender/io/collada/ImageExporter.cpp index 1223abbaf95..070eb36de31 100644 --- a/source/blender/io/collada/ImageExporter.cpp +++ b/source/blender/io/collada/ImageExporter.cpp @@ -70,7 +70,7 @@ void ImagesExporter::export_UV_Image(Image *image, bool use_copies) BLI_strncpy(export_file, name.c_str(), sizeof(export_file)); BKE_image_path_ensure_ext_from_imformat(export_file, &imageFormat); - BLI_join_dirfile(export_path, sizeof(export_path), export_dir, export_file); + BLI_path_join(export_path, sizeof(export_path), export_dir, export_file); /* make dest directory if it doesn't exist */ BLI_make_existing_file(export_path); diff --git a/source/blender/makesrna/intern/rna_sequencer.c b/source/blender/makesrna/intern/rna_sequencer.c index 634754d54cc..c952210eecf 100644 --- a/source/blender/makesrna/intern/rna_sequencer.c +++ b/source/blender/makesrna/intern/rna_sequencer.c @@ -778,7 +778,7 @@ static void rna_Sequence_filepath_get(PointerRNA *ptr, char *value) { Sequence *seq = (Sequence *)(ptr->data); - BLI_join_dirfile(value, FILE_MAX, seq->strip->dir, seq->strip->stripdata->name); + BLI_path_join(value, FILE_MAX, seq->strip->dir, seq->strip->stripdata->name); } static int rna_Sequence_filepath_length(PointerRNA *ptr) @@ -786,7 +786,7 @@ static int rna_Sequence_filepath_length(PointerRNA *ptr) Sequence *seq = (Sequence *)(ptr->data); char path[FILE_MAX]; - BLI_join_dirfile(path, sizeof(path), seq->strip->dir, seq->strip->stripdata->name); + BLI_path_join(path, sizeof(path), seq->strip->dir, seq->strip->stripdata->name); return strlen(path); } @@ -804,7 +804,7 @@ static void rna_Sequence_proxy_filepath_get(PointerRNA *ptr, char *value) { StripProxy *proxy = (StripProxy *)(ptr->data); - BLI_join_dirfile(value, FILE_MAX, proxy->dir, proxy->file); + BLI_path_join(value, FILE_MAX, proxy->dir, proxy->file); } static int rna_Sequence_proxy_filepath_length(PointerRNA *ptr) @@ -812,7 +812,7 @@ static int rna_Sequence_proxy_filepath_length(PointerRNA *ptr) StripProxy *proxy = (StripProxy *)(ptr->data); char path[FILE_MAX]; - BLI_join_dirfile(path, sizeof(path), proxy->dir, proxy->file); + BLI_path_join(path, sizeof(path), proxy->dir, proxy->file); return strlen(path); } diff --git a/source/blender/render/intern/render_result.cc b/source/blender/render/intern/render_result.cc index e8603f5e1b3..bd5c6a0f5c4 100644 --- a/source/blender/render/intern/render_result.cc +++ b/source/blender/render/intern/render_result.cc @@ -962,7 +962,7 @@ static void render_result_exr_file_cache_path(Scene *sce, sce->id.name + 2, path_hexdigest); - BLI_join_dirfile(r_path, FILE_CACHE_MAX, root, filename_full); + BLI_path_join(r_path, FILE_CACHE_MAX, root, filename_full); if (BLI_path_is_rel(r_path)) { BLI_path_abs(r_path, dirname); } diff --git a/source/blender/sequencer/intern/proxy.c b/source/blender/sequencer/intern/proxy.c index 4220efab8bf..9f08db2aa45 100644 --- a/source/blender/sequencer/intern/proxy.c +++ b/source/blender/sequencer/intern/proxy.c @@ -106,7 +106,7 @@ bool seq_proxy_get_custom_file_fname(Sequence *seq, char *name, const int view_i return false; } - BLI_join_dirfile(fname, PROXY_MAXFILE, proxy->dir, proxy->file); + BLI_path_join(fname, PROXY_MAXFILE, proxy->dir, proxy->file); BLI_path_abs(fname, BKE_main_blendfile_path_from_global()); if (view_id > 0) { @@ -325,7 +325,7 @@ static bool seq_proxy_multiview_context_invalid(Sequence *seq, Scene *scene, con if (view_id == 0) { char path[FILE_MAX]; - BLI_join_dirfile(path, sizeof(path), seq->strip->dir, seq->strip->stripdata->name); + BLI_path_join(path, sizeof(path), seq->strip->dir, seq->strip->stripdata->name); BLI_path_abs(path, BKE_main_blendfile_path_from_global()); BKE_scene_multiview_view_prefix_get(scene, path, prefix, &ext); } diff --git a/source/blender/sequencer/intern/render.c b/source/blender/sequencer/intern/render.c index 91ecccbe0f8..dbbece73695 100644 --- a/source/blender/sequencer/intern/render.c +++ b/source/blender/sequencer/intern/render.c @@ -938,7 +938,7 @@ static ImBuf *seq_render_image_strip(const SeqRenderData *context, return NULL; } - BLI_join_dirfile(name, sizeof(name), seq->strip->dir, s_elem->name); + BLI_path_join(name, sizeof(name), seq->strip->dir, s_elem->name); BLI_path_abs(name, BKE_main_blendfile_path_from_global()); /* Try to get a proxy image. */ diff --git a/source/blender/sequencer/intern/strip_add.c b/source/blender/sequencer/intern/strip_add.c index 753a6ee39e0..7f4c91724fc 100644 --- a/source/blender/sequencer/intern/strip_add.c +++ b/source/blender/sequencer/intern/strip_add.c @@ -204,7 +204,7 @@ void SEQ_add_image_init_alpha_mode(Sequence *seq) char name[FILE_MAX]; ImBuf *ibuf; - BLI_join_dirfile(name, sizeof(name), seq->strip->dir, seq->strip->stripdata->name); + BLI_path_join(name, sizeof(name), seq->strip->dir, seq->strip->stripdata->name); BLI_path_abs(name, BKE_main_blendfile_path_from_global()); /* Initialize input color space. */ @@ -545,7 +545,7 @@ void SEQ_add_reload_new_file(Main *bmain, Scene *scene, Sequence *seq, const boo const bool is_multiview = (seq->flag & SEQ_USE_VIEWS) != 0 && (scene->r.scemode & R_MULTIVIEW) != 0; - BLI_join_dirfile(path, sizeof(path), seq->strip->dir, seq->strip->stripdata->name); + BLI_path_join(path, sizeof(path), seq->strip->dir, seq->strip->stripdata->name); BLI_path_abs(path, BKE_main_blendfile_path_from_global()); SEQ_relations_sequence_free_anim(seq); diff --git a/source/blender/sequencer/intern/utils.c b/source/blender/sequencer/intern/utils.c index 6d182b6bcca..5b70bc33e88 100644 --- a/source/blender/sequencer/intern/utils.c +++ b/source/blender/sequencer/intern/utils.c @@ -224,7 +224,7 @@ void seq_open_anim_file(Scene *scene, Sequence *seq, bool openfile) /* reset all the previously created anims */ SEQ_relations_sequence_free_anim(seq); - BLI_join_dirfile(name, sizeof(name), seq->strip->dir, seq->strip->stripdata->name); + BLI_path_join(name, sizeof(name), seq->strip->dir, seq->strip->stripdata->name); BLI_path_abs(name, BKE_main_blendfile_path_from_global()); proxy = seq->strip->proxy; diff --git a/source/blender/windowmanager/intern/wm_files.c b/source/blender/windowmanager/intern/wm_files.c index a3593a33bae..b009a67efba 100644 --- a/source/blender/windowmanager/intern/wm_files.c +++ b/source/blender/windowmanager/intern/wm_files.c @@ -1406,7 +1406,7 @@ void wm_history_file_read(void) LinkNode *l; int num; - BLI_join_dirfile(name, sizeof(name), cfgdir, BLENDER_HISTORY_FILE); + BLI_path_join(name, sizeof(name), cfgdir, BLENDER_HISTORY_FILE); LinkNode *lines = BLI_file_read_as_lines(name); @@ -1469,7 +1469,7 @@ static void wm_history_file_write(void) return; } - BLI_join_dirfile(name, sizeof(name), user_config_dir, BLENDER_HISTORY_FILE); + BLI_path_join(name, sizeof(name), user_config_dir, BLENDER_HISTORY_FILE); fp = BLI_fopen(name, "w"); if (fp) { @@ -1930,7 +1930,7 @@ static void wm_autosave_location(char filepath[FILE_MAX]) } #endif - BLI_join_dirfile(filepath, FILE_MAX, tempdir_base, path); + BLI_path_join(filepath, FILE_MAX, tempdir_base, path); } static void wm_autosave_write(Main *bmain, wmWindowManager *wm) @@ -2020,7 +2020,7 @@ void wm_autosave_delete(void) if (BLI_exists(filepath)) { char str[FILE_MAX]; - BLI_join_dirfile(str, sizeof(str), BKE_tempdir_base(), BLENDER_QUIT_FILE); + BLI_path_join(str, sizeof(str), BKE_tempdir_base(), BLENDER_QUIT_FILE); /* if global undo; remove tempsave, otherwise rename */ if (U.uiflag & USER_GLOBALUNDO) { @@ -2915,7 +2915,7 @@ void WM_OT_revert_mainfile(wmOperatorType *ot) bool WM_file_recover_last_session(bContext *C, ReportList *reports) { char filepath[FILE_MAX]; - BLI_join_dirfile(filepath, sizeof(filepath), BKE_tempdir_base(), BLENDER_QUIT_FILE); + BLI_path_join(filepath, sizeof(filepath), BKE_tempdir_base(), BLENDER_QUIT_FILE); G.fileflags |= G_FILE_RECOVER_READ; const bool success = wm_file_read_opwrap(C, filepath, reports); G.fileflags &= ~G_FILE_RECOVER_READ; diff --git a/source/blender/windowmanager/intern/wm_files_link.c b/source/blender/windowmanager/intern/wm_files_link.c index 0ea783af1af..bbe53bf7355 100644 --- a/source/blender/windowmanager/intern/wm_files_link.c +++ b/source/blender/windowmanager/intern/wm_files_link.c @@ -210,7 +210,7 @@ static int wm_link_append_exec(bContext *C, wmOperator *op) RNA_string_get(op->ptr, "filename", relname); RNA_string_get(op->ptr, "directory", root); - BLI_join_dirfile(path, sizeof(path), root, relname); + BLI_path_join(path, sizeof(path), root, relname); /* test if we have a valid data */ if (!BLO_library_path_explode(path, libname, &group, &name)) { @@ -284,7 +284,7 @@ static int wm_link_append_exec(bContext *C, wmOperator *op) RNA_BEGIN (op->ptr, itemptr, "files") { RNA_string_get(&itemptr, "name", relname); - BLI_join_dirfile(path, sizeof(path), root, relname); + BLI_path_join(path, sizeof(path), root, relname); if (BLO_library_path_explode(path, libname, &group, &name)) { if (!wm_link_append_item_poll(NULL, path, group, name, do_append)) { @@ -303,7 +303,7 @@ static int wm_link_append_exec(bContext *C, wmOperator *op) RNA_BEGIN (op->ptr, itemptr, "files") { RNA_string_get(&itemptr, "name", relname); - BLI_join_dirfile(path, sizeof(path), root, relname); + BLI_path_join(path, sizeof(path), root, relname); if (BLO_library_path_explode(path, libname, &group, &name)) { BlendfileLinkAppendContextItem *item; @@ -683,7 +683,7 @@ static int wm_lib_relocate_exec_do(bContext *C, wmOperator *op, bool do_reload) return OPERATOR_CANCELLED; } - BLI_join_dirfile(path, sizeof(path), root, libname); + BLI_path_join(path, sizeof(path), root, libname); if (!BLI_exists(path)) { BKE_reportf(op->reports, @@ -739,7 +739,7 @@ static int wm_lib_relocate_exec_do(bContext *C, wmOperator *op, bool do_reload) RNA_BEGIN (op->ptr, itemptr, "files") { RNA_string_get(&itemptr, "name", relname); - BLI_join_dirfile(path, sizeof(path), root, relname); + BLI_path_join(path, sizeof(path), root, relname); if (BLI_path_cmp(path, lib->filepath_abs) == 0 || !BLO_has_bfile_extension(relname)) { continue; diff --git a/source/blender/windowmanager/intern/wm_init_exit.c b/source/blender/windowmanager/intern/wm_init_exit.c index 32890b4014f..c5d7152246c 100644 --- a/source/blender/windowmanager/intern/wm_init_exit.c +++ b/source/blender/windowmanager/intern/wm_init_exit.c @@ -447,7 +447,7 @@ void WM_exit_ex(bContext *C, const bool do_python) bool has_edited; const int fileflags = G.fileflags & ~G_FILE_COMPRESS; - BLI_join_dirfile(filepath, sizeof(filepath), BKE_tempdir_base(), BLENDER_QUIT_FILE); + BLI_path_join(filepath, sizeof(filepath), BKE_tempdir_base(), BLENDER_QUIT_FILE); has_edited = ED_editors_flush_edits(bmain); diff --git a/source/blender/windowmanager/intern/wm_platform_support.c b/source/blender/windowmanager/intern/wm_platform_support.c index a0519506d29..ee93621545f 100644 --- a/source/blender/windowmanager/intern/wm_platform_support.c +++ b/source/blender/windowmanager/intern/wm_platform_support.c @@ -42,7 +42,7 @@ static bool wm_platform_support_check_approval(const char *platform_support_key, bool result = false; char filepath[FILE_MAX]; - BLI_join_dirfile(filepath, sizeof(filepath), cfgdir, BLENDER_PLATFORM_SUPPORT_FILE); + BLI_path_join(filepath, sizeof(filepath), cfgdir, BLENDER_PLATFORM_SUPPORT_FILE); LinkNode *lines = BLI_file_read_as_lines(filepath); for (LinkNode *line_node = lines; line_node; line_node = line_node->next) { char *line = line_node->link; diff --git a/source/blender/windowmanager/intern/wm_splash_screen.c b/source/blender/windowmanager/intern/wm_splash_screen.c index 48325b28f5a..16e5f983bea 100644 --- a/source/blender/windowmanager/intern/wm_splash_screen.c +++ b/source/blender/windowmanager/intern/wm_splash_screen.c @@ -140,7 +140,7 @@ static ImBuf *wm_block_splash_image(int width, int *r_height) char template_directory[FILE_MAX]; if (BKE_appdir_app_template_id_search( U.app_template, template_directory, sizeof(template_directory))) { - BLI_join_dirfile(splash_filepath, sizeof(splash_filepath), template_directory, "splash.png"); + BLI_path_join(splash_filepath, sizeof(splash_filepath), template_directory, "splash.png"); ibuf = IMB_loadiffname(splash_filepath, IB_rect, NULL); } } diff --git a/source/creator/creator_signals.c b/source/creator/creator_signals.c index f67c4dde41d..c733ee617cb 100644 --- a/source/creator/creator_signals.c +++ b/source/creator/creator_signals.c @@ -101,7 +101,7 @@ static void sig_handle_crash(int signum) char fname[FILE_MAX]; if (!(G_MAIN && G_MAIN->filepath[0])) { - BLI_join_dirfile(fname, sizeof(fname), BKE_tempdir_base(), "crash.blend"); + BLI_path_join(fname, sizeof(fname), BKE_tempdir_base(), "crash.blend"); } else { STRNCPY(fname, G_MAIN->filepath); @@ -122,11 +122,10 @@ static void sig_handle_crash(int signum) char fname[FILE_MAX]; if (!(G_MAIN && G_MAIN->filepath[0])) { - BLI_join_dirfile(fname, sizeof(fname), BKE_tempdir_base(), "blender.crash.txt"); + BLI_path_join(fname, sizeof(fname), BKE_tempdir_base(), "blender.crash.txt"); } else { - BLI_join_dirfile( - fname, sizeof(fname), BKE_tempdir_base(), BLI_path_basename(G_MAIN->filepath)); + BLI_path_join(fname, sizeof(fname), BKE_tempdir_base(), BLI_path_basename(G_MAIN->filepath)); BLI_path_extension_replace(fname, sizeof(fname), ".crash.txt"); } |