From 414c70435dcd52eb67df59f56132837de0a63b64 Mon Sep 17 00:00:00 2001 From: Bastien Montagne Date: Mon, 23 Jun 2014 13:42:19 +0200 Subject: T39690: Modifications to Blender's 'temp dir' system. Current temporary data of Blender suffers one major issue - default 'temp' dir on Windows is never automatically cleaned up, and can end being quite big when used by Blender, especially when we have to store per-process data (using getpid() in file names). To address this, this patch: * Divides tempdir paths in two, one for 'base' temp dir (the same as previous unique tempdir path), the other is a mkdtemp-generated sub-dir, specific to each Blender instance. * Only uses base tempdir when we need some shallow persistance accross Blender sessions - and we always reuse the same filename (quit.blend...) or generate small file (crash reports...). * Uses temp sub-dir for heavy files like pointcache or renderEXRs (Save Buffer option). * Erases temp sub-dir on quit or crash. To get this working it also adds a working 'recursive delete' to BLI_delete() under Windows. Note that, as in current code, the 'recover render result' hack-feature that was possible with SaveBuffer option is still removed. A real renderresult cache feature will be added soon, though. Reviewers: campbellbarton, brecht, sergey Reviewed By: campbellbarton, sergey CC: sergey Differential Revision: https://developer.blender.org/D531 --- source/blender/blenlib/BLI_path_util.h | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'source/blender/blenlib/BLI_path_util.h') diff --git a/source/blender/blenlib/BLI_path_util.h b/source/blender/blenlib/BLI_path_util.h index b33b26a2feb..244c308a05c 100644 --- a/source/blender/blenlib/BLI_path_util.h +++ b/source/blender/blenlib/BLI_path_util.h @@ -191,12 +191,14 @@ void BLI_char_switch(char *string, char from, char to) ATTR_NONNULL(); void BLI_init_program_path(const char *argv0); /* Initialize path to temporary directory. * NOTE: On Window userdir will be set to the temporary directory! */ -void BLI_init_temporary_dir(char *userdir); +void BLI_temp_dir_init(char *userdir); const char *BLI_program_path(void); const char *BLI_program_dir(void); -const char *BLI_temporary_dir(void); +const char *BLI_temp_dir_session(void); +const char *BLI_temp_dir_base(void); void BLI_system_temporary_dir(char *dir); +void BLI_temp_dir_session_purge(void); #ifdef WITH_ICONV void BLI_string_to_utf8(char *original, char *utf_8, const char *code); -- cgit v1.2.3