diff options
Diffstat (limited to 'source/blender')
-rw-r--r-- | source/blender/blenlib/CMakeLists.txt | 3 | ||||
-rw-r--r-- | source/blender/blenlib/intern/path_util.c | 4 | ||||
-rw-r--r-- | source/blender/python/intern/bpy_interface.c | 14 |
3 files changed, 15 insertions, 6 deletions
diff --git a/source/blender/blenlib/CMakeLists.txt b/source/blender/blenlib/CMakeLists.txt index 9f6b1a8ab05..d5ed8956f7a 100644 --- a/source/blender/blenlib/CMakeLists.txt +++ b/source/blender/blenlib/CMakeLists.txt @@ -133,7 +133,8 @@ set(SRC intern/dynamiclist.h ) -if(CMAKE_SYSTEM_NAME MATCHES "Linux") +if(WITH_BINRELOC) + add_definitions(-DWITH_BINRELOC) list(APPEND INC "${BINRELOC_INC}") endif() diff --git a/source/blender/blenlib/intern/path_util.c b/source/blender/blenlib/intern/path_util.c index ec137d21033..10455e806b3 100644 --- a/source/blender/blenlib/intern/path_util.c +++ b/source/blender/blenlib/intern/path_util.c @@ -71,7 +71,7 @@ #else /* non windows */ -#ifdef __linux__ +#ifdef WITH_BINRELOC #include "binreloc.h" #endif @@ -1661,7 +1661,7 @@ void BLI_where_am_i(char *fullname, const int maxlen, const char *name) #endif -#ifdef __linux__ +#ifdef WITH_BINRELOC /* linux uses binreloc since argv[0] is not relyable, call br_init( NULL ) first */ path = br_find_exe( NULL ); if (path) { 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() */ |