diff options
author | Brecht Van Lommel <brechtvanlommel@pandora.be> | 2008-04-12 16:56:49 +0400 |
---|---|---|
committer | Brecht Van Lommel <brechtvanlommel@pandora.be> | 2008-04-12 16:56:49 +0400 |
commit | 6b02c7b12d0bfc712db61ab9ba9323ece65b9217 (patch) | |
tree | 4a4519248016d1491d6218777b9a18be18e60c25 | |
parent | 188687208968d95e57c6560f28da7b76aac1d574 (diff) |
Fix for bug #8930: issue removing temporary pointcache directory on windows.
-rw-r--r-- | source/blender/blenkernel/intern/pointcache.c | 14 |
1 files changed, 9 insertions, 5 deletions
diff --git a/source/blender/blenkernel/intern/pointcache.c b/source/blender/blenkernel/intern/pointcache.c index 3b411e758c0..e5c970a6b15 100644 --- a/source/blender/blenkernel/intern/pointcache.c +++ b/source/blender/blenkernel/intern/pointcache.c @@ -187,14 +187,17 @@ static int ptcache_path(PTCacheID *pid, char *filename) if (i > 6) file[i-6] = '\0'; - sprintf(filename, "//"PTCACHE_PATH"%s/", file); /* add blend file name to pointcache dir */ + sprintf(filename, "//"PTCACHE_PATH"%s", file); /* add blend file name to pointcache dir */ + BLI_add_slash(filename); BLI_convertstringcode(filename, blendfilename, 0); return strlen(filename); } /* use the temp path. this is weak but better then not using point cache at all */ /* btempdir is assumed to exist and ALWAYS has a trailing slash */ - return sprintf(filename, "%s"PTCACHE_PATH"%d/", btempdir, abs(getpid())); + sprintf(filename, "%s"PTCACHE_PATH"%d", btempdir, abs(getpid())); + BLI_add_slash(filename); + return strlen(filename); } static int BKE_ptcache_id_filename(PTCacheID *pid, char *filename, int cfra, short do_path, short do_ext) @@ -497,13 +500,12 @@ void BKE_ptcache_remove(void) ptcache_path(NULL, path); - if (BLI_exists(path)) { - /* TODO, Check with win32, probably needs last slash removed */ + if (BLI_exist(path)) { /* The pointcache dir exists? - remove all pointcache */ DIR *dir; struct dirent *de; - + dir = opendir(path); if (dir==NULL) return; @@ -518,6 +520,8 @@ void BKE_ptcache_remove(void) rmdir = 0; /* unknown file, dont remove the dir */ } } + + closedir(dir); } else { rmdir = 0; /* path dosnt exist */ } |