mirror of
https://github.com/rkd77/elinks.git
synced 2024-12-04 14:46:47 -05:00
[python] set program name
This commit is contained in:
parent
3ea2609ced
commit
aa586ee999
@ -13,6 +13,7 @@
|
|||||||
#include "elinks.h"
|
#include "elinks.h"
|
||||||
|
|
||||||
#include "config/home.h"
|
#include "config/home.h"
|
||||||
|
#include "main/main.h"
|
||||||
#include "main/module.h"
|
#include "main/module.h"
|
||||||
#include "scripting/python/core.h"
|
#include "scripting/python/core.h"
|
||||||
#include "scripting/python/dialogs.h"
|
#include "scripting/python/dialogs.h"
|
||||||
@ -377,6 +378,7 @@ python_error:
|
|||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static wchar_t *program_name;
|
||||||
|
|
||||||
void
|
void
|
||||||
init_python(struct module *module)
|
init_python(struct module *module)
|
||||||
@ -385,6 +387,14 @@ init_python(struct module *module)
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
program_name = Py_DecodeLocale(program.path, NULL);
|
||||||
|
|
||||||
|
if (program_name == NULL) {
|
||||||
|
fprintf(stderr, "Fatal error: cannot decode argv[0]\n");
|
||||||
|
exit(1);
|
||||||
|
}
|
||||||
|
Py_SetProgramName(program_name); /* optional but recommended */
|
||||||
|
|
||||||
PyImport_AppendInittab("elinks", PyInit_elinks);
|
PyImport_AppendInittab("elinks", PyInit_elinks);
|
||||||
|
|
||||||
Py_Initialize();
|
Py_Initialize();
|
||||||
@ -419,6 +429,7 @@ cleanup_python(struct module *module)
|
|||||||
Py_XDECREF(temp);
|
Py_XDECREF(temp);
|
||||||
|
|
||||||
Py_Finalize();
|
Py_Finalize();
|
||||||
|
PyMem_RawFree(program_name);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user