diff options
author | Campbell Barton <ideasman42@gmail.com> | 2020-03-07 05:23:26 +0300 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2020-03-07 05:26:23 +0300 |
commit | 0964865568802aba62737d899d6721ef5c58b63a (patch) | |
tree | 7e85df6a34a192085f94d181ba53d268bc6c1632 /source/blender/editors | |
parent | 8fb1ea857ffef370acb020f6573c165100923e1b (diff) |
Cleanup: replace BLI_make_file_string with BLI_join_dirfile where possible
Use 'BLI_join_dirfile' for joining paths that don't need to expand '//'.
Diffstat (limited to 'source/blender/editors')
-rw-r--r-- | source/blender/editors/armature/pose_transform.c | 4 | ||||
-rw-r--r-- | source/blender/editors/space_file/file_ops.c | 40 | ||||
-rw-r--r-- | source/blender/editors/space_file/fsmenu.c | 16 | ||||
-rw-r--r-- | source/blender/editors/space_file/space_file.c | 2 | ||||
-rw-r--r-- | source/blender/editors/space_outliner/outliner_edit.c | 4 | ||||
-rw-r--r-- | source/blender/editors/space_view3d/view3d_ops.c | 4 |
6 files changed, 39 insertions, 31 deletions
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) { |