diff options
author | Campbell Barton <ideasman42@gmail.com> | 2021-01-26 07:18:10 +0300 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2021-01-26 07:18:10 +0300 |
commit | 71a8e32dc0c0ae899fe1a9bd3a34f9f2ef52d196 (patch) | |
tree | 646658b42f53fa919811e3422dc516565f415b40 | |
parent | 7d2f746369e6f79bc6282990d9b1e10764462077 (diff) | |
parent | d55d95b04da42f120406678fc47deb00081f7285 (diff) |
Merge branch 'blender-v2.92-release'
-rw-r--r-- | source/blender/windowmanager/WM_api.h | 2 | ||||
-rw-r--r-- | source/blender/windowmanager/intern/wm_files.c | 31 |
2 files changed, 10 insertions, 23 deletions
diff --git a/source/blender/windowmanager/WM_api.h b/source/blender/windowmanager/WM_api.h index fd4535ff94f..69177f39c04 100644 --- a/source/blender/windowmanager/WM_api.h +++ b/source/blender/windowmanager/WM_api.h @@ -188,7 +188,7 @@ bool WM_stereo3d_enabled(struct wmWindow *win, bool only_fullscreen_test); void WM_file_autoexec_init(const char *filepath); bool WM_file_read(struct bContext *C, const char *filepath, struct ReportList *reports); void WM_autosave_init(struct wmWindowManager *wm); -void WM_recover_last_session(struct bContext *C, struct ReportList *reports); +bool WM_recover_last_session(struct bContext *C, struct ReportList *reports); void WM_file_tag_modified(void); struct ID *WM_file_append_datablock(struct Main *bmain, diff --git a/source/blender/windowmanager/intern/wm_files.c b/source/blender/windowmanager/intern/wm_files.c index d179cc456f4..bfc3d7e1a5f 100644 --- a/source/blender/windowmanager/intern/wm_files.c +++ b/source/blender/windowmanager/intern/wm_files.c @@ -2549,35 +2549,22 @@ void WM_OT_revert_mainfile(wmOperatorType *ot) /** \name Recover Last Session Operator * \{ */ -void WM_recover_last_session(bContext *C, ReportList *reports) +bool WM_recover_last_session(bContext *C, ReportList *reports) { char filepath[FILE_MAX]; - BLI_join_dirfile(filepath, sizeof(filepath), BKE_tempdir_base(), BLENDER_QUIT_FILE); - /* if reports==NULL, it's called directly without operator, we add a quick check here */ - if (reports || BLI_exists(filepath)) { - G.fileflags |= G_FILE_RECOVER; - - wm_file_read_opwrap(C, filepath, reports, true); - - G.fileflags &= ~G_FILE_RECOVER; - - /* XXX bad global... fixme */ - Main *bmain = CTX_data_main(C); - if (BKE_main_blendfile_path(bmain)[0] != '\0') { - G.file_loaded = 1; /* prevents splash to show */ - } - else { - G.relbase_valid = 0; - G.save_over = 0; /* start with save preference untitled.blend */ - } - } + G.fileflags |= G_FILE_RECOVER; + const bool success = wm_file_read_opwrap(C, filepath, reports, true); + G.fileflags &= ~G_FILE_RECOVER; + return success; } static int wm_recover_last_session_exec(bContext *C, wmOperator *op) { - WM_recover_last_session(C, op->reports); - return OPERATOR_FINISHED; + if (WM_recover_last_session(C, op->reports)) { + return OPERATOR_FINISHED; + } + return OPERATOR_CANCELLED; } void WM_OT_recover_last_session(wmOperatorType *ot) |