bugfix - Blender.GetPaths() was returning relative paths from libraries, but with no way to access the library path the the file is relative too. Check for these cases and make them absolute.

bpath also assigned one var it didnt need to.
This commit is contained in:
2008-06-06 08:58:08 +00:00
parent 6ffadbfb10
commit 14393c9ffb
2 changed files with 7 additions and 4 deletions

View File

@@ -456,13 +456,10 @@ void checkMissingFiles( char *txtname ) {
/* be sure there is low chance of the path being too short */
char filepath_expanded[FILE_MAXDIR*2];
char *libpath;
int files_missing = 0;
BLI_bpathIterator_init(&bpi);
while (!BLI_bpathIterator_isDone(&bpi)) {
libpath = BLI_bpathIterator_getLib(&bpi);
BLI_bpathIterator_getPathExpanded( &bpi, filepath_expanded );
if (!BLI_exists(filepath_expanded)) {

View File

@@ -936,6 +936,7 @@ static PyObject *Blender_GetPaths( PyObject * self, PyObject *args, PyObject *ke
PyObject *list = PyList_New(0), *st; /* stupidly big string to be safe */
/* be sure there is low chance of the path being too short */
char filepath_expanded[FILE_MAXDIR*2];
char *lib;
int absolute = 0;
static char *kwlist[] = {"absolute", NULL};
@@ -952,7 +953,12 @@ static PyObject *Blender_GetPaths( PyObject * self, PyObject *args, PyObject *ke
if (absolute) {
BLI_bpathIterator_getPathExpanded( &bpi, filepath_expanded );
} else {
BLI_bpathIterator_getPath( &bpi, filepath_expanded );
lib = BLI_bpathIterator_getLib( &bpi );
if ( lib && ( strcmp(lib, G.sce) ) ) { /* relative path to the library is NOT the same as our blendfile path, return an absolute path */
BLI_bpathIterator_getPathExpanded( &bpi, filepath_expanded );
} else {
BLI_bpathIterator_getPath( &bpi, filepath_expanded );
}
}
st = PyString_FromString(filepath_expanded);