[Bf-blender-cvs] [ba872f0] master: Gooseberry request, append the file name to autosaves as well as the pid

Antony Riakiotakis noreply at git.blender.org
Thu Nov 6 12:43:04 CET 2014


Commit: ba872f022cd40d3ff9f2314830dcac5204a6c506
Author: Antony Riakiotakis
Date:   Thu Nov 6 12:42:47 2014 +0100
Branches: master
https://developer.blender.org/rBba872f022cd40d3ff9f2314830dcac5204a6c506

Gooseberry request, append the file name to autosaves as well as the pid

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

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 8f0f764..f1e9f30 100644
--- a/source/blender/windowmanager/intern/wm_files.c
+++ b/source/blender/windowmanager/intern/wm_files.c
@@ -1069,11 +1069,16 @@ int wm_userpref_write_exec(bContext *C, wmOperator *op)
 void wm_autosave_location(char *filepath)
 {
 	char pidstr[32];
+	char path[1024];
 #ifdef WIN32
 	const char *savedir;
 #endif
 
-	BLI_snprintf(pidstr, sizeof(pidstr), "%d.blend", abs(getpid()));
+	BLI_snprintf(pidstr, sizeof(pidstr), "%d", abs(getpid()));
+	if (G.main)
+		BLI_snprintf(path, sizeof(path), "%s-%s", pidstr, BLI_path_basename(G.main->name));
+	else
+		BLI_snprintf(path, sizeof(path), "%s.blend", pidstr);
 
 #ifdef WIN32
 	/* XXX Need to investigate how to handle default location of '/tmp/'
@@ -1086,12 +1091,12 @@ void wm_autosave_location(char *filepath)
 	 * If there is no C:\tmp autosave fails. */
 	if (!BLI_exists(BLI_temp_dir_base())) {
 		savedir = BLI_get_folder_create(BLENDER_USER_AUTOSAVE, NULL);
-		BLI_make_file_string("/", filepath, savedir, pidstr);
+		BLI_make_file_string("/", filepath, savedir, path);
 		return;
 	}
 #endif
 
-	BLI_make_file_string("/", filepath, BLI_temp_dir_base(), pidstr);
+	BLI_make_file_string("/", filepath, BLI_temp_dir_base(), path);
 }
 
 void WM_autosave_init(wmWindowManager *wm)




More information about the Bf-blender-cvs mailing list