diff options
author | Campbell Barton <ideasman42@gmail.com> | 2011-02-21 16:13:08 +0300 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2011-02-21 16:13:08 +0300 |
commit | 9ef0eed4b64325092dc90bf2db0ca9825fd94f83 (patch) | |
tree | 179c4ae843eb3192683457e19d2ea903b8690b70 /source/blender/python | |
parent | ef60ae95215ef9fe88a93e97f70413e8075506e4 (diff) |
build python module without binreloc, add dummy argv[0] to initialize bprogname.
Diffstat (limited to 'source/blender/python')
-rw-r--r-- | source/blender/python/intern/bpy_interface.c | 14 |
1 files changed, 11 insertions, 3 deletions
diff --git a/source/blender/python/intern/bpy_interface.c b/source/blender/python/intern/bpy_interface.c index d1773e5fd7a..b6f0182a267 100644 --- a/source/blender/python/intern/bpy_interface.c +++ b/source/blender/python/intern/bpy_interface.c @@ -669,6 +669,7 @@ int BPY_context_member_get(bContext *C, const char *member, bContextDataResult * #ifdef WITH_PYTHON_MODULE +#include "BLI_storage.h" /* TODO, reloading the module isnt functional at the moment. */ extern int main_python(int argc, const char **argv); @@ -687,9 +688,16 @@ static struct PyModuleDef bpy_proxy_def = { PyMODINIT_FUNC PyInit_bpy(void) { - int argc= 0; - const char *argv[]={NULL}; - + int argc= 1; + char *argv[2]={NULL, NULL}; + + /* give the CWD as the first arg, blender uses */ + char path[240]= ""; + BLI_getwdN(path, sizeof(path)); + BLI_join_dirfile(path, sizeof(path), path, "bpy"); + argv[0]= path; + /* done with cwd */ + main_python(argc, argv); /* initialized in BPy_init_modules() */ |