From e10f8c27a256eb8881bb17eb1ba7426573ff208a Mon Sep 17 00:00:00 2001 From: Julian Eisel Date: Fri, 6 Sep 2019 11:06:32 +0200 Subject: UI: Confirmation prompt for file path auto-create This confirmation prompt was there earlier, we removed the prompts for creating new directories all together, but in this case it's reasonable. Without it, it's simply too easy to create new directories by accident. --- source/blender/editors/space_file/file_ops.c | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'source/blender/editors/space_file') diff --git a/source/blender/editors/space_file/file_ops.c b/source/blender/editors/space_file/file_ops.c index 5168300d21e..cb3b11fb8e6 100644 --- a/source/blender/editors/space_file/file_ops.c +++ b/source/blender/editors/space_file/file_ops.c @@ -2059,6 +2059,7 @@ void FILE_OT_directory_new(struct wmOperatorType *ot) ot->idname = "FILE_OT_directory_new"; /* api callbacks */ + ot->invoke = WM_operator_confirm_or_exec; ot->exec = file_directory_new_exec; ot->poll = ED_operator_file_active; /* <- important, handler is on window level */ @@ -2067,6 +2068,7 @@ void FILE_OT_directory_new(struct wmOperatorType *ot) RNA_def_property_flag(prop, PROP_SKIP_SAVE); prop = RNA_def_boolean(ot->srna, "open", false, "Open", "Open new directory"); RNA_def_property_flag(prop, PROP_SKIP_SAVE); + WM_operator_properties_confirm_or_exec(ot); } /* TODO This should go to BLI_path_utils. */ @@ -2198,6 +2200,8 @@ void file_directory_enter_handle(bContext *C, void *UNUSED(arg_unused), void *UN WM_operator_properties_create_ptr(&ptr, ot); RNA_string_set(&ptr, "directory", sfile->params->dir); RNA_boolean_set(&ptr, "open", true); + /* Enable confirmation prompt, else it's too easy to accidentaly create new directories. */ + RNA_boolean_set(&ptr, "confirm", true); if (lastdir) { BLI_strncpy(sfile->params->dir, lastdir, sizeof(sfile->params->dir)); -- cgit v1.2.3