From 4682a0882f02c50b20aa3c4bf9abe9f7ec2e834b Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Thu, 24 Mar 2022 16:33:32 +1100 Subject: Cleanup: use "filepath" instead of "filename" for full paths Reserve "filename" when only the name component is used. --- source/blender/editors/curve/editfont.c | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) (limited to 'source/blender/editors/curve/editfont.c') diff --git a/source/blender/editors/curve/editfont.c b/source/blender/editors/curve/editfont.c index 0afb1c2f4af..611dbb2e80c 100644 --- a/source/blender/editors/curve/editfont.c +++ b/source/blender/editors/curve/editfont.c @@ -526,16 +526,16 @@ static bool font_paste_utf8(bContext *C, const char *str, const size_t str_len) /** \name Paste From File Operator * \{ */ -static int paste_from_file(bContext *C, ReportList *reports, const char *filename) +static int paste_from_file(bContext *C, ReportList *reports, const char *filepath) { Object *obedit = CTX_data_edit_object(C); char *strp; size_t filelen; int retval; - strp = BLI_file_read_text_as_mem(filename, 1, &filelen); + strp = BLI_file_read_text_as_mem(filepath, 1, &filelen); if (strp == NULL) { - BKE_reportf(reports, RPT_ERROR, "Failed to open file '%s'", filename); + BKE_reportf(reports, RPT_ERROR, "Failed to open file '%s'", filepath); return OPERATOR_CANCELLED; } strp[filelen] = 0; @@ -545,7 +545,7 @@ static int paste_from_file(bContext *C, ReportList *reports, const char *filenam retval = OPERATOR_FINISHED; } else { - BKE_reportf(reports, RPT_ERROR, "File too long %s", filename); + BKE_reportf(reports, RPT_ERROR, "File too long %s", filepath); retval = OPERATOR_CANCELLED; } @@ -556,12 +556,12 @@ static int paste_from_file(bContext *C, ReportList *reports, const char *filenam static int paste_from_file_exec(bContext *C, wmOperator *op) { - char *path; + char *filepath; int retval; - path = RNA_string_get_alloc(op->ptr, "filepath", NULL, 0, NULL); - retval = paste_from_file(C, op->reports, path); - MEM_freeN(path); + filepath = RNA_string_get_alloc(op->ptr, "filepath", NULL, 0, NULL); + retval = paste_from_file(C, op->reports, filepath); + MEM_freeN(filepath); return retval; } @@ -2091,7 +2091,7 @@ static int font_open_exec(bContext *C, wmOperator *op) static int open_invoke(bContext *C, wmOperator *op, const wmEvent *UNUSED(event)) { VFont *vfont = NULL; - const char *path; + const char *filepath; PointerRNA idptr; PropertyPointerRNA *pprop; @@ -2106,13 +2106,13 @@ static int open_invoke(bContext *C, wmOperator *op, const wmEvent *UNUSED(event) vfont = (VFont *)idptr.owner_id; } - path = (vfont && !BKE_vfont_is_builtin(vfont)) ? vfont->filepath : U.fontdir; + filepath = (vfont && !BKE_vfont_is_builtin(vfont)) ? vfont->filepath : U.fontdir; if (RNA_struct_property_is_set(op->ptr, "filepath")) { return font_open_exec(C, op); } - RNA_string_set(op->ptr, "filepath", path); + RNA_string_set(op->ptr, "filepath", filepath); WM_event_add_fileselect(C, op); return OPERATOR_RUNNING_MODAL; -- cgit v1.2.3