Fix T45375: Cant clear temp fluid cache after closing Blender (Windows).
authorBastien Montagne <montagne29@wanadoo.fr>
Sun, 12 Jul 2015 16:47:29 +0000 (18:47 +0200)
committerBastien Montagne <montagne29@wanadoo.fr>
Sun, 12 Jul 2015 16:49:02 +0000 (18:49 +0200)
There was two different issues here actually:
* Own (very high) stupidity only gave 8 chars to file name (sic).
* list dir returns dirpaths without a trailing slahs, but expects them to have it it seems. :|

source/blender/blenlib/intern/fileops.c

index c3e889842c122c954575c8844f7692c3b9f32535..5af59a32e099dc9e3a3c0b1455b806df9f026c2a 100644 (file)
@@ -314,12 +314,20 @@ static bool delete_recursive(const char *dir)
        i = nbr = BLI_filelist_dir_contents(dir, &filelist);
        fl = filelist;
        while (i--) {
-               char file[8];
+               char file[FILE_MAXFILE];
+
                BLI_split_file_part(fl->path, file, sizeof(file));
+
                if (FILENAME_IS_CURRPAR(file)) {
                        /* Skip! */
                }
                else if (S_ISDIR(fl->type)) {
+                       char path[FILE_MAXDIR];
+
+                       /* dir listing produces dir path without trailing slash... */
+                       BLI_strncpy(path, fl->path, sizeof(path));
+                       BLI_add_slash(path);
+
                        if (delete_recursive(fl->path)) {
                                err = true;
                        }