diff options
Diffstat (limited to 'ui-macos/bits/runpython.c')
-rw-r--r-- | ui-macos/bits/runpython.c | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/ui-macos/bits/runpython.c b/ui-macos/bits/runpython.c index 2d982f5..63de339 100644 --- a/ui-macos/bits/runpython.c +++ b/ui-macos/bits/runpython.c @@ -7,8 +7,17 @@ * goes wrong if your interpreter is /usr/bin/python. */ #include <Python.h> +#include <string.h> +#include <unistd.h> int main(int argc, char **argv) { - return Py_Main(argc, argv); -}
\ No newline at end of file + char *path = strdup(argv[0]), *cptr; + char *args[] = {argv[0], "../Resources/main.py", NULL}; + cptr = strrchr(path, '/'); + if (cptr) + *cptr = 0; + chdir(path); + free(path); + return Py_Main(2, args); +} |