From 8ad2642c4717dcfad31626f7eebac325a9827b73 Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Mon, 13 Dec 2021 16:22:19 +1100 Subject: Cleanup: use "filepath" term for Main, BlendFileData & FileGlobal Use "filepath" which is the current convention for naming full paths. - Main use "name" which isn't obviously a file path. - BlendFileData & FileGlobal used "filename" which is often used for the name component of a path (without the directory). --- source/blender/windowmanager/intern/wm_files.c | 16 ++++++++-------- source/blender/windowmanager/intern/wm_init_exit.c | 4 ++-- source/blender/windowmanager/intern/wm_window.c | 2 +- 3 files changed, 11 insertions(+), 11 deletions(-) (limited to 'source/blender/windowmanager') diff --git a/source/blender/windowmanager/intern/wm_files.c b/source/blender/windowmanager/intern/wm_files.c index a2a09f9b0bc..e753c083805 100644 --- a/source/blender/windowmanager/intern/wm_files.c +++ b/source/blender/windowmanager/intern/wm_files.c @@ -1356,7 +1356,7 @@ void wm_homefile_read_ex(bContext *C, if (use_data) { WM_check(C); /* opens window(s), checks keymaps */ - bmain->name[0] = '\0'; + bmain->filepath[0] = '\0'; /* start with save preference untitled.blend */ G.save_over = 0; @@ -1828,7 +1828,7 @@ static bool wm_file_write(bContext *C, /* First time saving. */ /* XXX(ton): temp solution to solve bug, real fix coming. */ if ((BKE_main_blendfile_path(bmain)[0] == '\0') && (use_save_as_copy == false)) { - BLI_strncpy(bmain->name, filepath, sizeof(bmain->name)); + STRNCPY(bmain->filepath, filepath); } /* XXX(ton): temp solution to solve bug, real fix coming. */ @@ -1849,7 +1849,7 @@ static bool wm_file_write(bContext *C, if (use_save_as_copy == false) { G.relbase_valid = 1; - BLI_strncpy(bmain->name, filepath, sizeof(bmain->name)); /* is guaranteed current file */ + STRNCPY(bmain->filepath, filepath); /* is guaranteed current file */ G.save_over = 1; /* disable untitled.blend convention */ } @@ -3035,21 +3035,21 @@ static void save_set_filepath(bContext *C, wmOperator *op) { Main *bmain = CTX_data_main(C); PropertyRNA *prop; - char name[FILE_MAX]; + char filepath[FILE_MAX]; prop = RNA_struct_find_property(op->ptr, "filepath"); if (!RNA_property_is_set(op->ptr, prop)) { /* if not saved before, get the name of the most recently used .blend file */ if (BKE_main_blendfile_path(bmain)[0] == '\0' && G.recent_files.first) { struct RecentFile *recent = G.recent_files.first; - BLI_strncpy(name, recent->filepath, FILE_MAX); + STRNCPY(filepath, recent->filepath); } else { - BLI_strncpy(name, bmain->name, FILE_MAX); + STRNCPY(filepath, bmain->filepath); } - wm_filepath_default(name); - RNA_property_string_set(op->ptr, prop, name); + wm_filepath_default(filepath); + RNA_property_string_set(op->ptr, prop, filepath); } } diff --git a/source/blender/windowmanager/intern/wm_init_exit.c b/source/blender/windowmanager/intern/wm_init_exit.c index 4b3bc009388..2f87e5789fe 100644 --- a/source/blender/windowmanager/intern/wm_init_exit.c +++ b/source/blender/windowmanager/intern/wm_init_exit.c @@ -314,9 +314,9 @@ void WM_init(bContext *C, int argc, const char **argv) NULL, ¶ms_file_read_post); - /* NOTE: leave `G_MAIN->name` set to an empty string since this + /* NOTE: leave `G_MAIN->filepath` set to an empty string since this * matches behavior after loading a new file. */ - BLI_assert(G_MAIN->name[0] == '\0'); + BLI_assert(G_MAIN->filepath[0] == '\0'); /* Call again to set from preferences. */ BLT_lang_set(NULL); diff --git a/source/blender/windowmanager/intern/wm_window.c b/source/blender/windowmanager/intern/wm_window.c index 35f971e72e4..86abfe881ff 100644 --- a/source/blender/windowmanager/intern/wm_window.c +++ b/source/blender/windowmanager/intern/wm_window.c @@ -429,7 +429,7 @@ void wm_window_title(wmWindowManager *wm, wmWindow *win) else if (win->ghostwin) { /* this is set to 1 if you don't have startup.blend open */ if (G.save_over && BKE_main_blendfile_path_from_global()[0]) { - char str[sizeof(((Main *)NULL)->name) + 24]; + char str[sizeof(((Main *)NULL)->filepath) + 24]; BLI_snprintf(str, sizeof(str), "Blender%s [%s%s]", -- cgit v1.2.3