diff options
Diffstat (limited to 'source/blender/python/intern/bpy.c')
-rw-r--r-- | source/blender/python/intern/bpy.c | 38 |
1 files changed, 19 insertions, 19 deletions
diff --git a/source/blender/python/intern/bpy.c b/source/blender/python/intern/bpy.c index 1f8385288bd..01567a87fdf 100644 --- a/source/blender/python/intern/bpy.c +++ b/source/blender/python/intern/bpy.c @@ -32,13 +32,17 @@ #include <Python.h> -#include "RNA_types.h" -#include "RNA_access.h" - +#include "BLI_utildefines.h" #include "BLI_path_util.h" #include "BLI_string.h" + +#include "BKE_main.h" +#include "BKE_global.h" /* XXX, G.main only */ +#include "BKE_blender.h" #include "BKE_bpath.h" -#include "BLI_utildefines.h" + +#include "RNA_types.h" +#include "RNA_access.h" #include "bpy.h" #include "bpy_util.h" @@ -48,10 +52,6 @@ #include "bpy_library.h" #include "bpy_operator.h" -#include "BKE_main.h" -#include "BKE_global.h" /* XXX, G.main only */ -#include "BKE_blender.h" - #include "MEM_guardedalloc.h" /* external util modules */ @@ -78,7 +78,7 @@ static PyObject *bpy_script_paths(PyObject *UNUSED(self)) { PyObject *ret = PyTuple_New(2); PyObject *item; - char *path; + const char *path; path = BLI_get_folder(BLENDER_SYSTEM_SCRIPTS, NULL); item = PyUnicode_DecodeFSDefault(path ? path : ""); @@ -151,16 +151,16 @@ static PyObject *bpy_user_resource(PyObject *UNUSED(self), PyObject *args, PyObj int folder_id; static const char *kwlist[] = {"type", "subdir", NULL}; - char *path; + const char *path; if (!PyArg_ParseTupleAndKeywords(args, kw, "s|s:user_resource", (char **)kwlist, &type, &subdir)) return NULL; /* stupid string compare */ - if (!strcmp(type, "DATAFILES")) folder_id = BLENDER_USER_DATAFILES; - else if (!strcmp(type, "CONFIG")) folder_id = BLENDER_USER_CONFIG; - else if (!strcmp(type, "SCRIPTS")) folder_id = BLENDER_USER_SCRIPTS; - else if (!strcmp(type, "AUTOSAVE")) folder_id = BLENDER_USER_AUTOSAVE; + if (STREQ(type, "DATAFILES")) folder_id = BLENDER_USER_DATAFILES; + else if (STREQ(type, "CONFIG")) folder_id = BLENDER_USER_CONFIG; + else if (STREQ(type, "SCRIPTS")) folder_id = BLENDER_USER_SCRIPTS; + else if (STREQ(type, "AUTOSAVE")) folder_id = BLENDER_USER_AUTOSAVE; else { PyErr_SetString(PyExc_ValueError, "invalid resource argument"); return NULL; @@ -195,15 +195,15 @@ static PyObject *bpy_resource_path(PyObject *UNUSED(self), PyObject *args, PyObj int major = BLENDER_VERSION / 100, minor = BLENDER_VERSION % 100; static const char *kwlist[] = {"type", "major", "minor", NULL}; int folder_id; - char *path; + const char *path; if (!PyArg_ParseTupleAndKeywords(args, kw, "s|ii:resource_path", (char **)kwlist, &type, &major, &minor)) return NULL; /* stupid string compare */ - if (!strcmp(type, "USER")) folder_id = BLENDER_RESOURCE_PATH_USER; - else if (!strcmp(type, "LOCAL")) folder_id = BLENDER_RESOURCE_PATH_LOCAL; - else if (!strcmp(type, "SYSTEM")) folder_id = BLENDER_RESOURCE_PATH_SYSTEM; + if (STREQ(type, "USER")) folder_id = BLENDER_RESOURCE_PATH_USER; + else if (STREQ(type, "LOCAL")) folder_id = BLENDER_RESOURCE_PATH_LOCAL; + else if (STREQ(type, "SYSTEM")) folder_id = BLENDER_RESOURCE_PATH_SYSTEM; else { PyErr_SetString(PyExc_ValueError, "invalid resource argument"); return NULL; @@ -249,7 +249,7 @@ void BPy_init_modules(void) PyObject *mod; /* Needs to be first since this dir is needed for future modules */ - char *modpath = BLI_get_folder(BLENDER_SYSTEM_SCRIPTS, "modules"); + const char * const modpath = BLI_get_folder(BLENDER_SYSTEM_SCRIPTS, "modules"); if (modpath) { // printf("bpy: found module path '%s'.\n", modpath); PyObject *sys_path = PySys_GetObject("path"); /* borrow */ |