Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBastien Montagne <montagne29@wanadoo.fr>2014-06-23 15:42:19 +0400
committerBastien Montagne <montagne29@wanadoo.fr>2014-06-23 15:42:54 +0400
commit414c70435dcd52eb67df59f56132837de0a63b64 (patch)
tree27f305e446db2c647e8725dfbc47e6468b880701 /source/creator
parent9b987103f6684f9abe55cd536b718bc95cb06f24 (diff)
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
Diffstat (limited to 'source/creator')
-rw-r--r--source/creator/creator.c12
1 files changed, 7 insertions, 5 deletions
diff --git a/source/creator/creator.c b/source/creator/creator.c
index 0dad2fd6b75..11837025777 100644
--- a/source/creator/creator.c
+++ b/source/creator/creator.c
@@ -566,7 +566,7 @@ static void blender_crash_handler(int signum)
char fname[FILE_MAX];
if (!G.main->name[0]) {
- BLI_make_file_string("/", fname, BLI_temporary_dir(), "crash.blend");
+ BLI_make_file_string("/", fname, BLI_temp_dir_base(), "crash.blend");
}
else {
BLI_strncpy(fname, G.main->name, sizeof(fname));
@@ -587,10 +587,10 @@ static void blender_crash_handler(int signum)
char fname[FILE_MAX];
if (!G.main->name[0]) {
- BLI_join_dirfile(fname, sizeof(fname), BLI_temporary_dir(), "blender.crash.txt");
+ BLI_join_dirfile(fname, sizeof(fname), BLI_temp_dir_base(), "blender.crash.txt");
}
else {
- BLI_join_dirfile(fname, sizeof(fname), BLI_temporary_dir(), BLI_path_basename(G.main->name));
+ BLI_join_dirfile(fname, sizeof(fname), BLI_temp_dir_base(), BLI_path_basename(G.main->name));
BLI_replace_extension(fname, sizeof(fname), ".crash.txt");
}
@@ -621,6 +621,8 @@ static void blender_crash_handler(int signum)
fclose(fp);
}
+ /* Delete content of temp dir! */
+ BLI_temp_dir_session_purge();
/* really crash */
signal(signum, SIG_DFL);
@@ -1666,7 +1668,7 @@ int main(
/* this is properly initialized with user defs, but this is default */
/* call after loading the startup.blend so we can read U.tempdir */
- BLI_init_temporary_dir(U.tempdir);
+ BLI_temp_dir_init(U.tempdir);
}
else {
#ifndef WITH_PYTHON_MODULE
@@ -1676,7 +1678,7 @@ int main(
WM_init(C, argc, (const char **)argv);
/* don't use user preferences temp dir */
- BLI_init_temporary_dir(NULL);
+ BLI_temp_dir_init(NULL);
}
#ifdef WITH_PYTHON
/**