From ba872f022cd40d3ff9f2314830dcac5204a6c506 Mon Sep 17 00:00:00 2001 From: Antony Riakiotakis Date: Thu, 6 Nov 2014 12:42:47 +0100 Subject: Gooseberry request, append the file name to autosaves as well as the pid --- source/blender/windowmanager/intern/wm_files.c | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) (limited to '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 8f0f76466e9..f1e9f30dac5 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) -- cgit v1.2.3