From 88b24bc6bbbf35bde00c55834330b56708f25897 Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Mon, 15 Mar 2021 13:30:43 +1100 Subject: Writefile: only include recovery info in auto-save & quit.blend Previously all blend files included the path they were saved, causing files distributed publicly to include users local paths. This also included developers home directories for startup & userprefs defaults & app-templates bundled with Blender. Now recovery information is only written for auto-save & quit.blend since this is the only time they're intended to be used. --- source/blender/blenkernel/intern/blender_undo.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'source/blender/blenkernel/intern/blender_undo.c') diff --git a/source/blender/blenkernel/intern/blender_undo.c b/source/blender/blenkernel/intern/blender_undo.c index 9f8a30722c2..293b2c9c4c6 100644 --- a/source/blender/blenkernel/intern/blender_undo.c +++ b/source/blender/blenkernel/intern/blender_undo.c @@ -115,6 +115,9 @@ MemFileUndoData *BKE_memfile_undo_encode(Main *bmain, MemFileUndoData *mfu_prev) { MemFileUndoData *mfu = MEM_callocN(sizeof(MemFileUndoData), __func__); + /* Include recovery infomation since undo-data is written out as #BLENDER_QUIT_FILE. */ + const int fileflags = G.fileflags | G_FILE_RECOVER_WRITE; + /* disk save version */ if (UNDO_DISK) { static int counter = 0; @@ -129,7 +132,7 @@ MemFileUndoData *BKE_memfile_undo_encode(Main *bmain, MemFileUndoData *mfu_prev) BLI_join_dirfile(filename, sizeof(filename), BKE_tempdir_session(), numstr); /* success = */ /* UNUSED */ BLO_write_file( - bmain, filename, G.fileflags, &(const struct BlendFileWriteParams){0}, NULL); + bmain, filename, fileflags, &(const struct BlendFileWriteParams){0}, NULL); BLI_strncpy(mfu->filename, filename, sizeof(mfu->filename)); } @@ -138,7 +141,7 @@ MemFileUndoData *BKE_memfile_undo_encode(Main *bmain, MemFileUndoData *mfu_prev) if (prevfile) { BLO_memfile_clear_future(prevfile); } - /* success = */ /* UNUSED */ BLO_write_file_mem(bmain, prevfile, &mfu->memfile, G.fileflags); + /* success = */ /* UNUSED */ BLO_write_file_mem(bmain, prevfile, &mfu->memfile, fileflags); mfu->undo_size = mfu->memfile.size; } -- cgit v1.2.3