diff --git a/source/blender/blenkernel/intern/blender_undo.c b/source/blender/blenkernel/intern/blender_undo.c index cd950e05415..9ccc53b6318 100644 --- a/source/blender/blenkernel/intern/blender_undo.c +++ b/source/blender/blenkernel/intern/blender_undo.c @@ -109,7 +109,7 @@ MemFileUndoData *BKE_memfile_undo_encode(Main *bmain, MemFileUndoData *mfu_prev) counter = counter % U.undosteps; BLI_snprintf(numstr, sizeof(numstr), "%d.blend", counter); - BLI_make_file_string("/", filename, BKE_tempdir_session(), numstr); + BLI_join_dirfile(filename, sizeof(filename), BKE_tempdir_session(), numstr); /* success = */ /* UNUSED */ BLO_write_file(bmain, filename, fileflags, NULL, NULL); diff --git a/source/blender/editors/armature/pose_transform.c b/source/blender/editors/armature/pose_transform.c index d366978ba2b..0360f385201 100644 --- a/source/blender/editors/armature/pose_transform.c +++ b/source/blender/editors/armature/pose_transform.c @@ -723,7 +723,7 @@ static int pose_copy_exec(bContext *C, wmOperator *op) * existing on it's own. */ BKE_copybuffer_tag_ID(&ob_copy.id); - BLI_make_file_string("/", str, BKE_tempdir_base(), "copybuffer_pose.blend"); + BLI_join_dirfile(str, sizeof(str), BKE_tempdir_base(), "copybuffer_pose.blend"); BKE_copybuffer_save(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 @@ -773,7 +773,7 @@ static int pose_paste_exec(bContext *C, wmOperator *op) /* Read copy buffer .blend file. */ char str[FILE_MAX]; Main *tmp_bmain = BKE_main_new(); - BLI_make_file_string("/", str, BKE_tempdir_base(), "copybuffer_pose.blend"); + BLI_join_dirfile(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/space_file/file_ops.c b/source/blender/editors/space_file/file_ops.c index e03d15d9f34..5004bb8dd77 100644 --- a/source/blender/editors/space_file/file_ops.c +++ b/source/blender/editors/space_file/file_ops.c @@ -948,8 +948,10 @@ static int bookmark_add_exec(bContext *C, wmOperator *UNUSED(op)) fsmenu_insert_entry( fsmenu, FS_CATEGORY_BOOKMARKS, params->dir, NULL, ICON_FILE_FOLDER, FS_INSERT_SAVE); - BLI_make_file_string( - "/", name, BKE_appdir_folder_id_create(BLENDER_USER_CONFIG, NULL), BLENDER_BOOKMARK_FILE); + BLI_join_dirfile(name, + sizeof(name), + BKE_appdir_folder_id_create(BLENDER_USER_CONFIG, NULL), + BLENDER_BOOKMARK_FILE); fsmenu_write_file(fsmenu, name); } @@ -991,10 +993,10 @@ static int bookmark_delete_exec(bContext *C, wmOperator *op) char name[FILE_MAX]; fsmenu_remove_entry(fsmenu, FS_CATEGORY_BOOKMARKS, index); - BLI_make_file_string("/", - name, - BKE_appdir_folder_id_create(BLENDER_USER_CONFIG, NULL), - BLENDER_BOOKMARK_FILE); + BLI_join_dirfile(name, + sizeof(name), + BKE_appdir_folder_id_create(BLENDER_USER_CONFIG, NULL), + BLENDER_BOOKMARK_FILE); fsmenu_write_file(fsmenu, name); ED_area_tag_refresh(sa); ED_area_tag_redraw(sa); @@ -1045,8 +1047,10 @@ static int bookmark_cleanup_exec(bContext *C, wmOperator *UNUSED(op)) if (changed) { char name[FILE_MAX]; - BLI_make_file_string( - "/", name, BKE_appdir_folder_id_create(BLENDER_USER_CONFIG, NULL), BLENDER_BOOKMARK_FILE); + BLI_join_dirfile(name, + sizeof(name), + BKE_appdir_folder_id_create(BLENDER_USER_CONFIG, NULL), + BLENDER_BOOKMARK_FILE); fsmenu_write_file(fsmenu, name); fsmenu_refresh_bookmarks_status(CTX_wm_manager(C), fsmenu); ED_area_tag_refresh(sa); @@ -1122,8 +1126,10 @@ static int bookmark_move_exec(bContext *C, wmOperator *op) /* Need to update active bookmark number. */ sfile->bookmarknr = new_index; - BLI_make_file_string( - "/", fname, BKE_appdir_folder_id_create(BLENDER_USER_CONFIG, NULL), BLENDER_BOOKMARK_FILE); + BLI_join_dirfile(fname, + sizeof(fname), + BKE_appdir_folder_id_create(BLENDER_USER_CONFIG, NULL), + BLENDER_BOOKMARK_FILE); fsmenu_write_file(fsmenu, fname); ED_area_tag_redraw(sa); @@ -1168,8 +1174,10 @@ static int reset_recent_exec(bContext *C, wmOperator *UNUSED(op)) while (ED_fsmenu_get_entry(fsmenu, FS_CATEGORY_RECENT, 0) != NULL) { fsmenu_remove_entry(fsmenu, FS_CATEGORY_RECENT, 0); } - BLI_make_file_string( - "/", name, BKE_appdir_folder_id_create(BLENDER_USER_CONFIG, NULL), BLENDER_BOOKMARK_FILE); + BLI_join_dirfile(name, + sizeof(name), + BKE_appdir_folder_id_create(BLENDER_USER_CONFIG, NULL), + BLENDER_BOOKMARK_FILE); fsmenu_write_file(fsmenu, name); ED_area_tag_redraw(sa); @@ -1571,10 +1579,10 @@ int file_exec(bContext *C, wmOperator *exec_op) FS_INSERT_SAVE | FS_INSERT_FIRST); } - BLI_make_file_string(BKE_main_blendfile_path(bmain), - filepath, - BKE_appdir_folder_id_create(BLENDER_USER_CONFIG, NULL), - BLENDER_BOOKMARK_FILE); + BLI_join_dirfile(filepath, + sizeof(filepath), + BKE_appdir_folder_id_create(BLENDER_USER_CONFIG, NULL), + BLENDER_BOOKMARK_FILE); fsmenu_write_file(ED_fsmenu_get(), filepath); WM_event_fileselect_event(wm, op, EVT_FILESELECT_EXEC); } diff --git a/source/blender/editors/space_file/fsmenu.c b/source/blender/editors/space_file/fsmenu.c index 017adfa22bb..4f3fc997074 100644 --- a/source/blender/editors/space_file/fsmenu.c +++ b/source/blender/editors/space_file/fsmenu.c @@ -267,10 +267,10 @@ void ED_fsmenu_entry_set_path(struct FSMenuEntry *fsentry, const char *path) fsentry->path = (path && path[0]) ? BLI_strdup(path) : NULL; - BLI_make_file_string("/", - tmp_name, - BKE_appdir_folder_id_create(BLENDER_USER_CONFIG, NULL), - BLENDER_BOOKMARK_FILE); + BLI_join_dirfile(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); } } @@ -332,10 +332,10 @@ void ED_fsmenu_entry_set_name(struct FSMenuEntry *fsentry, const char *name) BLI_strncpy(fsentry->name, name, sizeof(fsentry->name)); } - BLI_make_file_string("/", - tmp_name, - BKE_appdir_folder_id_create(BLENDER_USER_CONFIG, NULL), - BLENDER_BOOKMARK_FILE); + BLI_join_dirfile(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); } } diff --git a/source/blender/editors/space_file/space_file.c b/source/blender/editors/space_file/space_file.c index c7dee1c1680..11d759b5b75 100644 --- a/source/blender/editors/space_file/space_file.c +++ b/source/blender/editors/space_file/space_file.c @@ -802,7 +802,7 @@ void ED_file_read_bookmarks(void) if (cfgdir) { char name[FILE_MAX]; - BLI_make_file_string("/", name, cfgdir, BLENDER_BOOKMARK_FILE); + BLI_join_dirfile(name, sizeof(name), cfgdir, BLENDER_BOOKMARK_FILE); fsmenu_read_bookmarks(ED_fsmenu_get(), name); } } diff --git a/source/blender/editors/space_outliner/outliner_edit.c b/source/blender/editors/space_outliner/outliner_edit.c index 945bfb55b1b..1d852d72e6e 100644 --- a/source/blender/editors/space_outliner/outliner_edit.c +++ b/source/blender/editors/space_outliner/outliner_edit.c @@ -770,7 +770,7 @@ static int outliner_id_copy_exec(bContext *C, wmOperator *op) return OPERATOR_CANCELLED; } - BLI_make_file_string("/", str, BKE_tempdir_base(), "copybuffer.blend"); + BLI_join_dirfile(str, sizeof(str), BKE_tempdir_base(), "copybuffer.blend"); BKE_copybuffer_save(bmain, str, op->reports); BKE_reportf(op->reports, RPT_INFO, "Copied %d selected data-block(s)", num_ids); @@ -797,7 +797,7 @@ static int outliner_id_paste_exec(bContext *C, wmOperator *op) char str[FILE_MAX]; const short flag = FILE_AUTOSELECT | FILE_ACTIVE_COLLECTION; - BLI_make_file_string("/", str, BKE_tempdir_base(), "copybuffer.blend"); + BLI_join_dirfile(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_view3d/view3d_ops.c b/source/blender/editors/space_view3d/view3d_ops.c index cfdd3dcbb6f..be8824971cb 100644 --- a/source/blender/editors/space_view3d/view3d_ops.c +++ b/source/blender/editors/space_view3d/view3d_ops.c @@ -76,7 +76,7 @@ static int view3d_copybuffer_exec(bContext *C, wmOperator *op) } CTX_DATA_END; - BLI_make_file_string("/", str, BKE_tempdir_base(), "copybuffer.blend"); + BLI_join_dirfile(str, sizeof(str), BKE_tempdir_base(), "copybuffer.blend"); BKE_copybuffer_save(bmain, str, op->reports); BKE_reportf(op->reports, RPT_INFO, "Copied %d selected object(s)", num_copied); @@ -108,7 +108,7 @@ static int view3d_pastebuffer_exec(bContext *C, wmOperator *op) flag |= FILE_ACTIVE_COLLECTION; } - BLI_make_file_string("/", str, BKE_tempdir_base(), "copybuffer.blend"); + BLI_join_dirfile(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/io/collada/DocumentExporter.cpp b/source/blender/io/collada/DocumentExporter.cpp index 24a960ab287..9d61b9b56ab 100644 --- a/source/blender/io/collada/DocumentExporter.cpp +++ b/source/blender/io/collada/DocumentExporter.cpp @@ -157,13 +157,12 @@ DocumentExporter::DocumentExporter(BlenderContext &blender_context, ExportSettin static COLLADABU::NativeString make_temp_filepath(const char *name, const char *extension) { char tempfile[FILE_MAX]; - const char *tempdir = BKE_tempdir_session(); if (name == NULL) { name = "untitled"; } - BLI_make_file_string(NULL, tempfile, tempdir, name); + BLI_join_dirfile(tempfile, sizeof(tempfile), BKE_tempdir_session(), name); if (extension) { BLI_path_extension_ensure(tempfile, FILE_MAX, extension); diff --git a/source/blender/render/intern/source/render_result.c b/source/blender/render/intern/source/render_result.c index 81395399134..2021967b05d 100644 --- a/source/blender/render/intern/source/render_result.c +++ b/source/blender/render/intern/source/render_result.c @@ -1335,7 +1335,7 @@ void render_result_exr_file_path(Scene *scene, const char *layname, int sample, /* Make name safe for paths, see T43275. */ BLI_filename_make_safe(name); - BLI_make_file_string("/", filepath, BKE_tempdir_session(), name); + BLI_join_dirfile(filepath, FILE_MAX, BKE_tempdir_session(), name); } /* called for reading temp files, and for external engines */ diff --git a/source/blender/windowmanager/intern/wm_files.c b/source/blender/windowmanager/intern/wm_files.c index 1ce56ad2dfc..83355ecb786 100644 --- a/source/blender/windowmanager/intern/wm_files.c +++ b/source/blender/windowmanager/intern/wm_files.c @@ -1088,7 +1088,7 @@ void wm_history_file_read(void) return; } - BLI_make_file_string("/", name, cfgdir, BLENDER_HISTORY_FILE); + BLI_join_dirfile(name, sizeof(name), cfgdir, BLENDER_HISTORY_FILE); lines = BLI_file_read_as_lines(name); @@ -1144,7 +1144,7 @@ static void wm_history_file_write(void) return; } - BLI_make_file_string("/", name, user_config_dir, BLENDER_HISTORY_FILE); + BLI_join_dirfile(name, sizeof(name), user_config_dir, BLENDER_HISTORY_FILE); fp = BLI_fopen(name, "w"); if (fp) { @@ -1487,7 +1487,7 @@ void wm_autosave_location(char *filepath) } #endif - BLI_make_file_string("/", filepath, BKE_tempdir_base(), path); + BLI_join_dirfile(filepath, FILE_MAX, BKE_tempdir_base(), path); } void WM_autosave_init(wmWindowManager *wm) @@ -1559,7 +1559,7 @@ void wm_autosave_delete(void) if (BLI_exists(filename)) { char str[FILE_MAX]; - BLI_make_file_string("/", str, BKE_tempdir_base(), BLENDER_QUIT_FILE); + BLI_join_dirfile(str, sizeof(str), BKE_tempdir_base(), BLENDER_QUIT_FILE); /* if global undo; remove tempsave, otherwise rename */ if (U.uiflag & USER_GLOBALUNDO) { @@ -2439,7 +2439,7 @@ void WM_recover_last_session(bContext *C, ReportList *reports) { char filepath[FILE_MAX]; - BLI_make_file_string("/", filepath, BKE_tempdir_base(), BLENDER_QUIT_FILE); + BLI_join_dirfile(filepath, sizeof(filepath), BKE_tempdir_base(), BLENDER_QUIT_FILE); /* if reports==NULL, it's called directly without operator, we add a quick check here */ if (reports || BLI_exists(filepath)) { G.fileflags |= G_FILE_RECOVER; diff --git a/source/blender/windowmanager/intern/wm_init_exit.c b/source/blender/windowmanager/intern/wm_init_exit.c index 7a05ef4b849..c428eefb028 100644 --- a/source/blender/windowmanager/intern/wm_init_exit.c +++ b/source/blender/windowmanager/intern/wm_init_exit.c @@ -358,7 +358,8 @@ void WM_init(bContext *C, int argc, const char **argv) /* allow a path of "", this is what happens when making a new file */ #if 0 if (BKE_main_blendfile_path_from_global()[0] == '\0') { - BLI_make_file_string("/", G_MAIN->name, BKE_appdir_folder_default(), "untitled.blend"); + BLI_join_dirfile( + G_MAIN->name, sizeof(G_MAIN->name), BKE_appdir_folder_default(), "untitled.blend"); } #endif @@ -495,7 +496,7 @@ void WM_exit_ex(bContext *C, const bool do_python) bool has_edited; int fileflags = G.fileflags & ~(G_FILE_COMPRESS | G_FILE_HISTORY); - BLI_make_file_string("/", filename, BKE_tempdir_base(), BLENDER_QUIT_FILE); + BLI_join_dirfile(filename, sizeof(filename), 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 94eceafc59b..73ba4b550c9 100644 --- a/source/blender/windowmanager/intern/wm_platform_support.c +++ b/source/blender/windowmanager/intern/wm_platform_support.c @@ -55,7 +55,7 @@ static bool wm_platform_support_check_approval(const char *platform_support_key, if (cfgdir) { char filepath[FILE_MAX]; - BLI_make_file_string("/", filepath, cfgdir, BLENDER_PLATFORM_SUPPORT_FILE); + BLI_join_dirfile(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/creator/creator_signals.c b/source/creator/creator_signals.c index afec54a636c..dff23837203 100644 --- a/source/creator/creator_signals.c +++ b/source/creator/creator_signals.c @@ -114,7 +114,7 @@ static void sig_handle_crash(int signum) char fname[FILE_MAX]; if (!(G_MAIN && G_MAIN->name[0])) { - BLI_make_file_string("/", fname, BKE_tempdir_base(), "crash.blend"); + BLI_join_dirfile(fname, sizeof(fname), BKE_tempdir_base(), "crash.blend"); } else { BLI_strncpy(fname, G_MAIN->name, sizeof(fname));