Commit 36d5465d authored by Vincent Castellano's avatar Vincent Castellano

Fixed string mangling from dirname

parent 1ca2fe69
......@@ -1320,6 +1320,9 @@ void py_init (const char *file) {
PyObject* sysPath = PySys_GetObject((char*)"path");
PyList_Append(sysPath, PyUnicode_FromString(dirname(filename)));
// Recopy the string in, since dirname modified it.
strncpy(filename, file, 1024);
// remove .py extension from file, if any
char* dot = strrchr(filename, '.');
if (dot && strcmp(dot, ".py") == 0)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment