diff options
author | Julian Eisel <eiseljulian@gmail.com> | 2019-09-06 12:21:47 +0300 |
---|---|---|
committer | Julian Eisel <eiseljulian@gmail.com> | 2019-09-06 12:21:47 +0300 |
commit | 5fd46d27f57f0abacf202cc6d147191998133557 (patch) | |
tree | bdd210e1868bce308ba9ba205308a02b1c573fb2 /source/blender/editors/space_file/file_ops.c | |
parent | e10f8c27a256eb8881bb17eb1ba7426573ff208a (diff) |
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.
Diffstat (limited to 'source/blender/editors/space_file/file_ops.c')
-rw-r--r-- | source/blender/editors/space_file/file_ops.c | 11 |
1 files changed, 7 insertions, 4 deletions
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); } |