Fixed string mangling from dirname
This commit is contained in:
parent
1ca2fe6941
commit
36d5465d81
@ -1320,6 +1320,9 @@ void py_init (const char *file) {
|
|||||||
PyObject* sysPath = PySys_GetObject((char*)"path");
|
PyObject* sysPath = PySys_GetObject((char*)"path");
|
||||||
PyList_Append(sysPath, PyUnicode_FromString(dirname(filename)));
|
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
|
// remove .py extension from file, if any
|
||||||
char* dot = strrchr(filename, '.');
|
char* dot = strrchr(filename, '.');
|
||||||
if (dot && strcmp(dot, ".py") == 0)
|
if (dot && strcmp(dot, ".py") == 0)
|
||||||
|
Loading…
Reference in New Issue
Block a user