[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [14391] trunk/blender/source/blender/ blenkernel/intern/pointcache.c:

Brecht Van Lommel brechtvanlommel at pandora.be
Sat Apr 12 14:56:49 CEST 2008


Revision: 14391
          http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=14391
Author:   blendix
Date:     2008-04-12 14:56:49 +0200 (Sat, 12 Apr 2008)

Log Message:
-----------

Fix for bug #8930: issue removing temporary pointcache directory on windows.

Modified Paths:
--------------
    trunk/blender/source/blender/blenkernel/intern/pointcache.c

Modified: trunk/blender/source/blender/blenkernel/intern/pointcache.c
===================================================================
--- trunk/blender/source/blender/blenkernel/intern/pointcache.c	2008-04-12 10:55:10 UTC (rev 14390)
+++ trunk/blender/source/blender/blenkernel/intern/pointcache.c	2008-04-12 12:56:49 UTC (rev 14391)
@@ -187,14 +187,17 @@
 		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 @@
 	
 	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 @@
 				rmdir = 0; /* unknown file, dont remove the dir */
 			}
 		}
+
+		closedir(dir);
 	} else { 
 		rmdir = 0; /* path dosnt exist  */
 	}





More information about the Bf-blender-cvs mailing list