[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [14550] trunk/blender/source/blender/ blenlib/intern/bpath.c: removed BLI_split_dirfile, it dosnt work with relative paths.

Campbell Barton ideasman42 at gmail.com
Fri Apr 25 19:52:43 CEST 2008


Revision: 14550
          http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=14550
Author:   campbellbarton
Date:     2008-04-25 19:52:25 +0200 (Fri, 25 Apr 2008)

Log Message:
-----------
removed BLI_split_dirfile, it dosnt work with relative paths.
it also makes a directory if its not there, need to look into other uses of this function.

Modified Paths:
--------------
    trunk/blender/source/blender/blenlib/intern/bpath.c

Modified: trunk/blender/source/blender/blenlib/intern/bpath.c
===================================================================
--- trunk/blender/source/blender/blenlib/intern/bpath.c	2008-04-25 17:39:40 UTC (rev 14549)
+++ trunk/blender/source/blender/blenlib/intern/bpath.c	2008-04-25 17:52:25 UTC (rev 14550)
@@ -259,15 +259,22 @@
 	
 	if (SEQ_HAS_PATH(seq)) {
 		if (seq->type == SEQ_IMAGE || seq->type == SEQ_MOVIE) {
-			char file[FILE_MAX];
-			BLI_split_dirfile(path, seq->strip->dir, file);
-			BLI_add_slash(seq->strip->dir); /* incase its missing */
 			
-			/* now append the filename */
+			int lslash, i = 0;
+			for (i=0; path[i]!='\0'; i++) {
+				if (path[i]=='\\' || path[i]=='/')
+					lslash = i+1;
+			}
+			
+			if (lslash) {
+				BLI_strncpy( seq->strip->dir, path, lslash+1); /* +1 to include the slash and the last char */
+			} else {
+				path[0] = '\0';
+			}
+			
 			if (seq->strip->stripdata) { /* should always be true! */
-				BLI_strncpy(seq->strip->stripdata->name, file, sizeof(seq->strip->stripdata->name));
+				BLI_strncpy( seq->strip->stripdata->name, path+lslash, sizeof(seq->strip->stripdata->name));
 			}
-			
 		} else {
 			/* simple case */
 			BLI_strncpy(seq->strip->dir, path, sizeof(seq->strip->dir));





More information about the Bf-blender-cvs mailing list