diff options
author | Campbell Barton <ideasman42@gmail.com> | 2008-02-29 18:50:28 +0300 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2008-02-29 18:50:28 +0300 |
commit | 96247ce19ca08a9db3da83148851e897f725cb1b (patch) | |
tree | 47ac3326ec9d40add038246bc54af39f174e23b3 /source/blender/src/usiblender.c | |
parent | 95b0176fdedd4ac4b891563fd88161d4213a0cc2 (diff) |
* Made BLI_join_dirfile() check before adding a slash between dir and file so as not to get /foo///bar.blend
* Pointcache now uses the process id to construct the path for unsaved files. (so 2 or more blender's open wont try to read/write the same pointcache)
* Temp pointcache is cleared when existing blender, added BIF_clear_tempfiles() for this. Should also be usedto clear EXR's in the temp dir (TODO), BIF_clear_tempfiles also needs to be added in more places. (On file load for instace)
Diffstat (limited to 'source/blender/src/usiblender.c')
-rw-r--r-- | source/blender/src/usiblender.c | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/source/blender/src/usiblender.c b/source/blender/src/usiblender.c index 68981583358..4a791ddfb79 100644 --- a/source/blender/src/usiblender.c +++ b/source/blender/src/usiblender.c @@ -84,6 +84,7 @@ #include "BKE_packedFile.h" #include "BKE_texture.h" #include "BKE_utildefines.h" +#include "BKE_pointcache.h" #ifdef WITH_VERSE #include "BKE_verse.h" @@ -541,6 +542,8 @@ void BIF_read_file(char *name) retval= BKE_read_exotic(name); if (retval== 0) { + BIF_clear_tempfiles(); + /* we didn't succeed, now try to read Blender file */ retval= BKE_read_file(name, NULL); @@ -591,6 +594,8 @@ int BIF_read_homefile(int from_memory) int success; struct TmpFont *tf; + BIF_clear_tempfiles(); + BLI_clean(home); tf= G.ttfdata.first; @@ -939,6 +944,16 @@ void BIF_write_autosave(void) BLO_write_file(tstr, write_flags, &err); } +/* remove temp files assosiated with this blend file when quitting, loading or saving in a new path */ +void BIF_clear_tempfiles( void ) +{ + /* TODO - remove exr files from the temp dir */ + + if (!G.relbase_valid) { /* We could have pointcache saved in tyhe temp dir, if its there */ + BKE_ptcache_remove(); + } +} + /* if global undo; remove tempsave, otherwise rename */ static void delete_autosave(void) { @@ -1019,6 +1034,9 @@ extern ListBase editelems; void exit_usiblender(void) { struct TmpFont *tf; + + BIF_clear_tempfiles(); + tf= G.ttfdata.first; while(tf) { |