diff options
author | Campbell Barton <ideasman42@gmail.com> | 2017-10-19 16:29:04 +0300 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2017-10-19 16:29:04 +0300 |
commit | 4d2416b99c472c9735e074d864dcf82a85da8c58 (patch) | |
tree | b0fcd2a2472a53bb5ccf2491ef8074f106e28bd3 | |
parent | 0f8a57de68f706f73c25c8c456113f25ed634662 (diff) | |
parent | 465b6333ccb5b56ced54ca342c60086c60ab21db (diff) |
Merge branch 'master' into blender2.8
-rw-r--r-- | source/creator/creator_args.c | 19 |
1 files changed, 14 insertions, 5 deletions
diff --git a/source/creator/creator_args.c b/source/creator/creator_args.c index 0a73426e12b..4ebc679cf0b 100644 --- a/source/creator/creator_args.c +++ b/source/creator/creator_args.c @@ -44,6 +44,8 @@ #include "BLI_fileops.h" #include "BLI_mempool.h" +#include "BLO_readfile.h" /* only for BLO_has_bfile_extension */ + #include "BKE_blender_version.h" #include "BKE_context.h" @@ -1740,11 +1742,18 @@ static int arg_handle_load_file(int UNUSED(argc), const char **argv, void *data) return -1; } - /* Just pretend a file was loaded, so the user can press Save and it'll save at the filename from the CLI. */ - BLI_strncpy(G.main->name, filename, FILE_MAX); - G.relbase_valid = true; - G.save_over = true; - printf("... opened default scene instead; saving will write to %s\n", filename); + if (BLO_has_bfile_extension(filename)) { + /* Just pretend a file was loaded, so the user can press Save and it'll save at the filename from the CLI. */ + BLI_strncpy(G.main->name, filename, FILE_MAX); + G.relbase_valid = true; + G.save_over = true; + printf("... opened default scene instead; saving will write to: %s\n", filename); + } + else { + printf("Error: argument has no '.blend' file extension, not using as new file, exiting! %s\n", filename); + G.is_break = true; + WM_exit(C); + } } G.file_loaded = 1; |