diff options
author | Matt Ebb <matt@mke3.net> | 2007-04-16 11:01:51 +0400 |
---|---|---|
committer | Matt Ebb <matt@mke3.net> | 2007-04-16 11:01:51 +0400 |
commit | 41142b05d2f9931314b80aa7aa421c0c7f82a69c (patch) | |
tree | 06f8af909931314107c6f91a214f81b857c089a2 /source/blender/src/usiblender.c | |
parent | 7fe8ea861ac083f500ea698a7e0154885dacec2c (diff) |
* Create autosave dir on windows if it doesn't exist
For a long time, Blender has shipped with a .B.blend with a default .B.blend
that has "/tmp" as a default temp directory. This, of course, doesn't usually
exist on Windows, so anyone who used Blender on Windows and didn't know
to manually update it, lost all auto save files.
Now on Windows, Blender checks to see if the directory in U.tmpdir exists,
and if it doesn't, it will create a new 'autosave' dir underneath the .blender
home directory and save auto save files in there.
Diffstat (limited to 'source/blender/src/usiblender.c')
-rw-r--r-- | source/blender/src/usiblender.c | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/source/blender/src/usiblender.c b/source/blender/src/usiblender.c index f7104762c8e..10fcfeb45aa 100644 --- a/source/blender/src/usiblender.c +++ b/source/blender/src/usiblender.c @@ -527,8 +527,25 @@ int BIF_read_homefile(int from_memory) static void get_autosave_location(char buf[FILE_MAXDIR+FILE_MAXFILE]) { char pidstr[32]; + char subdir[9]; + char savedir[FILE_MAXDIR]; sprintf(pidstr, "%d.blend", abs(getpid())); + +#ifdef WIN32 + if (!BLI_exists(U.tempdir)) { + BLI_strncpy(subdir, "autosave", sizeof(subdir)); + BLI_make_file_string("/", savedir, BLI_gethome(), subdir); + + /* create a new autosave dir + * function already checks for existence or not */ + BLI_recurdir_fileops(savedir); + + BLI_make_file_string("/", buf, savedir, pidstr); + return; + } +#endif + BLI_make_file_string("/", buf, U.tempdir, pidstr); } |