diff options
author | Campbell Barton <ideasman42@gmail.com> | 2008-04-25 21:52:25 +0400 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2008-04-25 21:52:25 +0400 |
commit | 2a72b986d4dc8b6bef845e5ca9bdbb6bbf0ff8f4 (patch) | |
tree | 8601421f65256126c8cf8a1a247180a109a08324 /source/blender/blenlib | |
parent | f4cb93bf1fea43dc6dda8e48eb2316d6b5b1895c (diff) |
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.
Diffstat (limited to 'source/blender/blenlib')
-rw-r--r-- | source/blender/blenlib/intern/bpath.c | 19 |
1 files changed, 13 insertions, 6 deletions
diff --git a/source/blender/blenlib/intern/bpath.c b/source/blender/blenlib/intern/bpath.c index dfa5226ebfa..4e4b47b2c92 100644 --- a/source/blender/blenlib/intern/bpath.c +++ b/source/blender/blenlib/intern/bpath.c @@ -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)); |