Code cleanup: don't use btempdir/bprogdir/bprogname globals anymore, but wrap

in BLI_ functions.
This commit is contained in:
2011-10-21 17:37:38 +00:00
parent 4d48dbe5fd
commit 00735ed9e4
17 changed files with 104 additions and 79 deletions

View File

@@ -93,8 +93,6 @@ static PyStructSequence_Desc app_info_desc= {
static PyObject *make_app_info(void)
{
extern char bprogname[]; /* argv[0] from creator.c */
PyObject *app_info;
int pos= 0;
@@ -118,7 +116,7 @@ static PyObject *make_app_info(void)
SetStrItem("");
#endif
SetStrItem(STRINGIFY(BLENDER_VERSION_CYCLE));
SetStrItem(bprogname);
SetStrItem(BLI_program_path());
SetObjItem(PyBool_FromLong(G.background));
/* build info */
@@ -200,8 +198,7 @@ static int bpy_app_debug_value_set(PyObject *UNUSED(self), PyObject *value, void
static PyObject *bpy_app_tempdir_get(PyObject *UNUSED(self), void *UNUSED(closure))
{
extern char btempdir[];
return PyC_UnicodeFromByte(btempdir);
return PyC_UnicodeFromByte(BLI_temporary_dir());
}
static PyObject *bpy_app_driver_dict_get(PyObject *UNUSED(self), void *UNUSED(closure))

View File

@@ -193,9 +193,9 @@ void BPY_python_start(int argc, const char **argv)
PyThreadState *py_tstate= NULL;
/* not essential but nice to set our name */
static wchar_t bprogname_wchar[FILE_MAXDIR+FILE_MAXFILE]; /* python holds a reference */
BLI_strncpy_wchar_from_utf8(bprogname_wchar, bprogname, sizeof(bprogname_wchar) / sizeof(wchar_t));
Py_SetProgramName(bprogname_wchar);
static wchar_t program_path_wchar[FILE_MAXDIR+FILE_MAXFILE]; /* python holds a reference */
BLI_strncpy_wchar_from_utf8(program_path_wchar, BLI_program_path(), sizeof(program_path_wchar) / sizeof(wchar_t));
Py_SetProgramName(program_path_wchar);
/* must run before python initializes */
PyImport_ExtendInittab(bpy_internal_modules);