diff options
author | Jacques Lucke <mail@jlucke.com> | 2019-04-17 17:54:28 +0300 |
---|---|---|
committer | Jacques Lucke <mail@jlucke.com> | 2019-04-17 17:54:28 +0300 |
commit | 5461a68852d746498ac29eb06b8e12f79519ad79 (patch) | |
tree | 10e59cad9c0ae057763e1bcc6764949defeed9ec | |
parent | 12aa9b21087f874fa4ec82e0582bfa80e6344fd5 (diff) |
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.
-rw-r--r-- | source/blender/windowmanager/intern/wm_files.c | 4 |
1 files changed, 2 insertions, 2 deletions
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 |