mirror of
https://github.com/panda3d/panda3d.git
synced 2025-10-03 10:22:45 -04:00
Whoops
This commit is contained in:
parent
a457d59aae
commit
9f3b801c22
@ -214,14 +214,17 @@ ns_get_environment_variable(const string &var) const {
|
|||||||
} else if (var == "MAIN_DIR") {
|
} else if (var == "MAIN_DIR") {
|
||||||
#ifdef HAVE_PYTHON
|
#ifdef HAVE_PYTHON
|
||||||
// If we're running from Python code, read out sys.argv.
|
// If we're running from Python code, read out sys.argv.
|
||||||
if (Py_IsInitialized() && PyObject* obj = PySys_GetObject((char*) "argv")) {
|
if (Py_IsInitialized()) {
|
||||||
Filename main_dir (PyString_AsString(PyList_GetItem(obj, 0)));
|
PyObject* obj = PySys_GetObject((char*) "argv");
|
||||||
if (main_dir.empty()) {
|
if (obj) {
|
||||||
// We must be running in the Python interpreter directly, so return the CWD.
|
Filename main_dir (PyString_AsString(PyList_GetItem(obj, 0)));
|
||||||
return get_cwd();
|
if (main_dir.empty()) {
|
||||||
|
// We must be running in the Python interpreter directly, so return the CWD.
|
||||||
|
return get_cwd();
|
||||||
|
}
|
||||||
|
main_dir.make_absolute();
|
||||||
|
return Filename(main_dir.get_dirname()).to_os_specific();
|
||||||
}
|
}
|
||||||
main_dir.make_absolute();
|
|
||||||
return Filename(main_dir.get_dirname()).to_os_specific();
|
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user