obs-scripting: Fix python lib path on MacOS

The libpython .dylib files on MacOS are in the python_path/lib
subdir. The user supplied python_path still needs to be to the actual
python root and not lib/ as the root path get's used as python home dir
so just add lib/ when loading the dylib.
This commit is contained in:
Rat 2019-09-26 23:37:00 +02:00
parent f6aed7cb72
commit e7801e10ba

View file

@ -32,6 +32,12 @@
#define SO_EXT ".dylib"
#endif
#ifdef __APPLE__
#define PYTHON_LIB_SUBDIR "lib/"
#else
#define PYTHON_LIB_SUBDIR ""
#endif
bool import_python(const char *python_path)
{
struct dstr lib_path;
@ -44,7 +50,7 @@ bool import_python(const char *python_path)
dstr_init_copy(&lib_path, python_path);
dstr_replace(&lib_path, "\\", "/");
if (!dstr_is_empty(&lib_path)) {
dstr_cat(&lib_path, "/");
dstr_cat(&lib_path, "/" PYTHON_LIB_SUBDIR);
}
dstr_cat(&lib_path, PYTHON_LIB SO_EXT);