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/creator/creator_args.c | 2 +- source/creator/creator_signals.c | 9 +++++---- 2 files changed, 6 insertions(+), 5 deletions(-) (limited to 'source/creator') diff --git a/source/creator/creator_args.c b/source/creator/creator_args.c index 896d29e0583..0259e028e63 100644 --- a/source/creator/creator_args.c +++ b/source/creator/creator_args.c @@ -1994,7 +1994,7 @@ static int arg_handle_load_file(int UNUSED(argc), const char **argv, void *data) if (BLO_has_bfile_extension(filename)) { /* Just pretend a file was loaded, so the user can press Save and it'll * save at the filename from the CLI. */ - BLI_strncpy(G_MAIN->name, filename, FILE_MAX); + STRNCPY(G_MAIN->filepath, filename); G.relbase_valid = true; G.save_over = true; printf("... opened default scene instead; saving will write to: %s\n", filename); diff --git a/source/creator/creator_signals.c b/source/creator/creator_signals.c index b74264fdddd..c23664d746f 100644 --- a/source/creator/creator_signals.c +++ b/source/creator/creator_signals.c @@ -117,11 +117,11 @@ static void sig_handle_crash(int signum) if (memfile) { char fname[FILE_MAX]; - if (!(G_MAIN && G_MAIN->name[0])) { + if (!(G_MAIN && G_MAIN->filepath[0])) { BLI_join_dirfile(fname, sizeof(fname), BKE_tempdir_base(), "crash.blend"); } else { - BLI_strncpy(fname, G_MAIN->name, sizeof(fname)); + STRNCPY(fname, G_MAIN->filepath); BLI_path_extension_replace(fname, sizeof(fname), ".crash.blend"); } @@ -138,11 +138,12 @@ static void sig_handle_crash(int signum) char fname[FILE_MAX]; - if (!(G_MAIN && G_MAIN->name[0])) { + if (!(G_MAIN && G_MAIN->filepath[0])) { BLI_join_dirfile(fname, sizeof(fname), BKE_tempdir_base(), "blender.crash.txt"); } else { - BLI_join_dirfile(fname, sizeof(fname), BKE_tempdir_base(), BLI_path_basename(G_MAIN->name)); + BLI_join_dirfile( + fname, sizeof(fname), BKE_tempdir_base(), BLI_path_basename(G_MAIN->filepath)); BLI_path_extension_replace(fname, sizeof(fname), ".crash.txt"); } -- cgit v1.2.3