From 9e0ef2668638f51bc3a64b40cb51a1b2beee1fbf Mon Sep 17 00:00:00 2001 From: Harley Acheson Date: Thu, 28 Aug 2025 16:48:45 +0200 Subject: [PATCH] Fix #145186: Allow opening non-existing blend from command line The PR restores the old behavior (after the changes in #139128) so that specifying a path to a non-existing blend file will load Blender with default blend default and with that name assigned. Paths to non-blend files will load blender but then give the new warning message. Pull Request: https://projects.blender.org/blender/blender/pulls/145274 --- source/creator/creator_args.cc | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/source/creator/creator_args.cc b/source/creator/creator_args.cc index 90df4ce9d34..d08641a7652 100644 --- a/source/creator/creator_args.cc +++ b/source/creator/creator_args.cc @@ -2675,18 +2675,18 @@ static bool handle_load_file(bContext *C, const char *filepath_arg, const bool l if (load_empty_file == false) { error_msg = error_msg_generic; } - else if (BLI_exists(filepath) && BKE_blendfile_extension_check(filepath)) { + else if (!BKE_blendfile_extension_check(filepath)) { + /* Non-blend. Continue loading and give warning. */ + G_MAIN->is_read_invalid = true; + return true; + } + else if (BLI_exists(filepath)) { /* When a file is found but can't be loaded, handling it as a new file * could cause it to be unintentionally overwritten (data loss). * Further this is almost certainly not that a user would expect or want. * If they do, they can delete the file beforehand. */ error_msg = error_msg_generic; } - else { - /* Non-blend or non-existing. Continue loading and give warning. */ - G_MAIN->is_read_invalid = true; - return true; - } if (error_msg) { fprintf(stderr, "Error: %s, exiting! %s\n", error_msg, filepath);