diff options
author | Antony Riakiotakis <kalast@gmail.com> | 2014-11-06 14:42:47 +0300 |
---|---|---|
committer | Antony Riakiotakis <kalast@gmail.com> | 2014-11-06 14:42:47 +0300 |
commit | ba872f022cd40d3ff9f2314830dcac5204a6c506 (patch) | |
tree | 3800a7b877d1223e4cadb331108846eb7033def5 | |
parent | 7d4c89e6dacd49aaee7ee25e7ea013f3689f9c17 (diff) |
Gooseberry request, append the file name to autosaves as well as the pid
-rw-r--r-- | source/blender/windowmanager/intern/wm_files.c | 11 |
1 files changed, 8 insertions, 3 deletions
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) |