removed BLI_split_dirfile, it dosnt work with relative paths.
authorCampbell Barton <ideasman42@gmail.com>
Fri, 25 Apr 2008 17:52:25 +0000 (17:52 +0000)
committerCampbell Barton <ideasman42@gmail.com>
Fri, 25 Apr 2008 17:52:25 +0000 (17:52 +0000)
it also makes a directory if its not there, need to look into other uses of this function.

source/blender/blenlib/intern/bpath.c

index dfa5226ebfa9b65005756fed751dfa1199950c2c..4e4b47b2c927c58762d673e85270746bf1bedb82 100644 (file)
@@ -259,15 +259,22 @@ void seq_setpath(struct BPathIterator *bpi, char *path) {
        
        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 */
-                       if (seq->strip->stripdata) { /* should always be true! */
-                               BLI_strncpy(seq->strip->stripdata->name, file, sizeof(seq->strip->stripdata->name));
+                       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, path+lslash, sizeof(seq->strip->stripdata->name));
+                       }
                } else {
                        /* simple case */
                        BLI_strncpy(seq->strip->dir, path, sizeof(seq->strip->dir));