[Bf-blender-cvs] [c54df2a] master: Remove files from recent-files list on failed open
Campbell Barton
noreply at git.blender.org
Wed Aug 5 13:31:20 CEST 2015
Commit: c54df2ad47026a35c2629ba115ced64e7f33a42e
Author: Campbell Barton
Date: Wed Aug 5 21:25:28 2015 +1000
Branches: master
https://developer.blender.org/rBc54df2ad47026a35c2629ba115ced64e7f33a42e
Remove files from recent-files list on failed open
===================================================================
M source/blender/windowmanager/intern/wm_files.c
===================================================================
diff --git a/source/blender/windowmanager/intern/wm_files.c b/source/blender/windowmanager/intern/wm_files.c
index 74be3bc..24c25fd 100644
--- a/source/blender/windowmanager/intern/wm_files.c
+++ b/source/blender/windowmanager/intern/wm_files.c
@@ -398,6 +398,8 @@ void WM_file_autoexec_init(const char *filepath)
bool WM_file_read(bContext *C, const char *filepath, ReportList *reports)
{
+ /* assume automated tasks with background, don't write recent file list */
+ const bool do_history = (G.background == false) && (CTX_wm_manager(C)->op_undo_depth == 0);
bool success = false;
int retval;
@@ -420,9 +422,6 @@ bool WM_file_read(bContext *C, const char *filepath, ReportList *reports)
int G_f = G.f;
ListBase wmbase;
- /* assume automated tasks with background, don't write recent file list */
- const bool do_history = (G.background == false) && (CTX_wm_manager(C)->op_undo_depth == 0);
-
/* put aside screens to match with persistent windows later */
/* also exit screens and editors */
wm_window_match_init(C, &wmbase);
@@ -528,6 +527,19 @@ bool WM_file_read(bContext *C, const char *filepath, ReportList *reports)
BLI_assert(!"invalid 'retval'");
}
+
+ if (success == false) {
+ /* remove from recent files list */
+ if (do_history) {
+ RecentFile *recent = BLI_findstring_ptr(&G.recent_files, filepath, offsetof(RecentFile, filepath));
+ if (recent) {
+ MEM_freeN(recent->filepath);
+ BLI_freelinkN(&G.recent_files, recent);
+ write_history();
+ }
+ }
+ }
+
WM_cursor_wait(0);
return success;
More information about the Bf-blender-cvs
mailing list