[Bf-blender-cvs] [5461a68852d] master: Avoid autosave name collisions

Jacques Lucke noreply at git.blender.org
Wed Apr 17 16:58:36 CEST 2019


Commit: 5461a68852d746498ac29eb06b8e12f79519ad79
Author: Jacques Lucke
Date:   Wed Apr 17 16:54:28 2019 +0200
Branches: master
https://developer.blender.org/rB5461a68852d746498ac29eb06b8e12f79519ad79

Avoid autosave name collisions

When the same .blend file was open in two instances of Blender,
the autosaved files would overwrite each other.

The solution is to put the pid into the filename.

The exact pattern is the result of a discussion with @pablovazquez.

===================================================================

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 a4e059effb4..2ac488f0fe5 100644
--- a/source/blender/windowmanager/intern/wm_files.c
+++ b/source/blender/windowmanager/intern/wm_files.c
@@ -1409,10 +1409,10 @@ void wm_autosave_location(char *filepath)
   if (G_MAIN && G.relbase_valid) {
     const char *basename = BLI_path_basename(BKE_main_blendfile_path_from_global());
     int len = strlen(basename) - 6;
-    BLI_snprintf(path, sizeof(path), "%.*s (autosave).blend", len, basename);
+    BLI_snprintf(path, sizeof(path), "%.*s_%d_autosave.blend", len, basename, pid);
   }
   else {
-    BLI_snprintf(path, sizeof(path), "%d (autosave).blend", pid);
+    BLI_snprintf(path, sizeof(path), "%d_autosave.blend", pid);
   }
 
 #ifdef WIN32



More information about the Bf-blender-cvs mailing list