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:
Mitchell Stokes
2011-03-21 09:29:28 +00:00
parent 4a305e7edb
commit 1f52d83a99

View File

@@ -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;
}
}