Slight corrections to the string formatting of autosave, thanks to

Campbell for the help!
This commit is contained in:
2014-11-06 13:08:43 +01:00
parent ba872f022c
commit 70f74daa5a

View File

@@ -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/'