From 5fd46d27f57f0abacf202cc6d147191998133557 Mon Sep 17 00:00:00 2001 From: Julian Eisel Date: Fri, 6 Sep 2019 11:21:47 +0200 Subject: Fix failing assert on directory auto-creation The failing assert was there before the recent file browser design overhaul. Might have been in there for quite a while in fact. Auto-creation in this case means that the file path would be created if a non-existent path was entered in the file browser path button. --- source/blender/editors/space_file/file_ops.c | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) (limited to 'source/blender/editors') diff --git a/source/blender/editors/space_file/file_ops.c b/source/blender/editors/space_file/file_ops.c index cb3b11fb8e6..9939351ee45 100644 --- a/source/blender/editors/space_file/file_ops.c +++ b/source/blender/editors/space_file/file_ops.c @@ -1976,6 +1976,7 @@ int file_directory_new_exec(bContext *C, wmOperator *op) wmWindowManager *wm = CTX_wm_manager(C); SpaceFile *sfile = CTX_wm_space_file(C); ScrArea *sa = CTX_wm_area(C); + const bool do_diropen = RNA_boolean_get(op->ptr, "open"); if (!sfile->params) { BKE_report(op->reports, RPT_WARNING, "No parent directory given"); @@ -2024,9 +2025,11 @@ int file_directory_new_exec(bContext *C, wmOperator *op) return OPERATOR_CANCELLED; } - /* now remember file to jump into editing */ - BLI_strncpy(sfile->params->renamefile, name, FILE_MAXFILE); - sfile->params->rename_flag = FILE_PARAMS_RENAME_PENDING; + /* If we don't enter the directory directly, remember file to jump into editing. */ + if (do_diropen == false) { + BLI_strncpy(sfile->params->renamefile, name, FILE_MAXFILE); + sfile->params->rename_flag = FILE_PARAMS_RENAME_PENDING; + } /* set timer to smoothly view newly generated file */ /* max 30 frs/sec */ @@ -2039,7 +2042,7 @@ int file_directory_new_exec(bContext *C, wmOperator *op) /* reload dir to make sure we're seeing what's in the directory */ ED_fileselect_clear(wm, sa, sfile); - if (RNA_boolean_get(op->ptr, "open")) { + if (do_diropen) { BLI_strncpy(sfile->params->dir, path, sizeof(sfile->params->dir)); ED_file_change_dir(C); } -- cgit v1.2.3