BGE Dynamic Loading: When given a relative path (starts with "//") for LibLoad(), make the path absolute. This helps resolve relative paths inside the library.
This commit is contained in:
@@ -642,6 +642,7 @@ static PyObject *gLibLoad(PyObject*, PyObject* args)
|
||||
{
|
||||
KX_Scene *kx_scene= gp_KetsjiScene;
|
||||
char *path;
|
||||
char abs_path[FILE_MAX] = {0};
|
||||
char *group;
|
||||
Py_buffer py_buffer;
|
||||
py_buffer.buf = NULL;
|
||||
@@ -652,7 +653,11 @@ static PyObject *gLibLoad(PyObject*, PyObject* args)
|
||||
|
||||
if (!py_buffer.buf)
|
||||
{
|
||||
if(kx_scene->GetSceneConverter()->LinkBlendFilePath(path, group, kx_scene, &err_str)) {
|
||||
// Make the path absolute
|
||||
BLI_strncpy(abs_path, path, sizeof(abs_path));
|
||||
BLI_path_abs(abs_path, gp_GamePythonPath);
|
||||
|
||||
if(kx_scene->GetSceneConverter()->LinkBlendFilePath(abs_path, group, kx_scene, &err_str)) {
|
||||
Py_RETURN_TRUE;
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user