[Bf-blender-cvs] [70f74da] master: Slight corrections to the string formatting of autosave, thanks to Campbell for the help!
Antony Riakiotakis
noreply at git.blender.org
Thu Nov 6 13:08:47 CET 2014
Commit: 70f74daa5a57692cfce67999734a1b925d894ec5
Author: Antony Riakiotakis
Date: Thu Nov 6 13:08:43 2014 +0100
Branches: master
https://developer.blender.org/rB70f74daa5a57692cfce67999734a1b925d894ec5
Slight corrections to the string formatting of autosave, thanks to
Campbell for the help!
===================================================================
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 f1e9f30..d6568ea 100644
--- a/source/blender/windowmanager/intern/wm_files.c
+++ b/source/blender/windowmanager/intern/wm_files.c
@@ -1068,17 +1068,20 @@ int wm_userpref_write_exec(bContext *C, wmOperator *op)
void wm_autosave_location(char *filepath)
{
- char pidstr[32];
+ const int pid = abs(getpid());
char path[1024];
#ifdef WIN32
const char *savedir;
#endif
- 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);
+ if (G.main && G.relbase_valid) {
+ const char *basename = BLI_path_basename(G.main->name);
+ int len = strlen(basename) - 6;
+ BLI_snprintf(path, sizeof(path), "%.*s-%d.blend", len, basename, pid);
+ }
+ else {
+ BLI_snprintf(path, sizeof(path), "%d.blend", pid);
+ }
#ifdef WIN32
/* XXX Need to investigate how to handle default location of '/tmp/'
More information about the Bf-blender-cvs
mailing list