diff options
author | Campbell Barton <ideasman42@gmail.com> | 2008-06-05 17:02:00 +0400 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2008-06-05 17:02:00 +0400 |
commit | 4f601b478c99ef9d74086e73a9eb38c9c598791d (patch) | |
tree | 9a1818119eb1fdff5a5643592a15135199461595 /source/blender/python | |
parent | cc0d7309234e0c5444a101ce414e322f917628dc (diff) |
* python sys.cleanpath() used strstr incorrectly, resulting in paths containing a slash, always returning a path that ends with a slash.
* python Blender.GetPaths() - absolute=0 wasnt working
* BLI_cleanup_file and BLI_cleanup_file were treating the // prefix as a duplicate path, now ignores //
* BLI_convertstringcode was removing the trailing slash from a path
(tested these path functions didnt mess up with some of the peach files and with pointcache)
Diffstat (limited to 'source/blender/python')
-rw-r--r-- | source/blender/python/api2_2x/Blender.c | 2 | ||||
-rw-r--r-- | source/blender/python/api2_2x/Sys.c | 5 |
2 files changed, 4 insertions, 3 deletions
diff --git a/source/blender/python/api2_2x/Blender.c b/source/blender/python/api2_2x/Blender.c index 6fce0864189..6b2e00f27de 100644 --- a/source/blender/python/api2_2x/Blender.c +++ b/source/blender/python/api2_2x/Blender.c @@ -952,7 +952,7 @@ static PyObject *Blender_GetPaths( PyObject * self, PyObject *args, PyObject *ke if (absolute) { BLI_bpathIterator_getPathExpanded( &bpi, filepath_expanded ); } else { - BLI_bpathIterator_getPathExpanded( &bpi, filepath_expanded ); + BLI_bpathIterator_getPath( &bpi, filepath_expanded ); } st = PyString_FromString(filepath_expanded); diff --git a/source/blender/python/api2_2x/Sys.c b/source/blender/python/api2_2x/Sys.c index 3863cc12227..b0d18f9f4aa 100644 --- a/source/blender/python/api2_2x/Sys.c +++ b/source/blender/python/api2_2x/Sys.c @@ -406,11 +406,12 @@ static PyObject *M_sys_cleanpath( PyObject * self, PyObject * value ) { char *path = PyString_AsString(value); char cleaned[FILE_MAXDIR + FILE_MAXFILE]; - int trailing_slash = 0; + int trailing_slash = 0, last; if (!path) return EXPP_ReturnPyObjError( PyExc_TypeError, "expected string argument" ); - if (strstr(path, "/") || strstr(path, "\\")) { + last = strlen(path)-1; + if ((path[last]=='/') || (path[last]=='\\')) { trailing_slash = 1; } BLI_strncpy(cleaned, path, FILE_MAXDIR + FILE_MAXFILE); |