Changeset View
Changeset View
Standalone View
Standalone View
source/blender/python/intern/bpy.c
| Show First 20 Lines • Show All 161 Lines • ▼ Show 20 Lines | static PyObject *bpy_user_resource(PyObject *UNUSED(self), PyObject *args, PyObject *kw) | ||||
| else if (STREQ(type, "SCRIPTS")) folder_id = BLENDER_USER_SCRIPTS; | else if (STREQ(type, "SCRIPTS")) folder_id = BLENDER_USER_SCRIPTS; | ||||
| else if (STREQ(type, "AUTOSAVE")) folder_id = BLENDER_USER_AUTOSAVE; | else if (STREQ(type, "AUTOSAVE")) folder_id = BLENDER_USER_AUTOSAVE; | ||||
| else { | else { | ||||
| PyErr_SetString(PyExc_ValueError, "invalid resource argument"); | PyErr_SetString(PyExc_ValueError, "invalid resource argument"); | ||||
| return NULL; | return NULL; | ||||
| } | } | ||||
| /* same logic as BKE_appdir_folder_id_create(), but best leave it up to the script author to create */ | /* same logic as BKE_appdir_folder_id_create(), but best leave it up to the script author to create */ | ||||
| path = BKE_appdir_folder_id(folder_id, subdir); | |||||
campbellbarton: This changes the behavior of how the directories are selected, however since using an… | |||||
| if (!path) | |||||
| path = BKE_appdir_folder_id_user_notest(folder_id, subdir); | path = BKE_appdir_folder_id_user_notest(folder_id, subdir); | ||||
| return PyC_UnicodeFromByte(path ? path : ""); | return PyC_UnicodeFromByte(path ? path : ""); | ||||
| } | } | ||||
| PyDoc_STRVAR(bpy_resource_path_doc, | PyDoc_STRVAR(bpy_resource_path_doc, | ||||
| ".. function:: resource_path(type, major=bpy.app.version[0], minor=bpy.app.version[1])\n" | ".. function:: resource_path(type, major=bpy.app.version[0], minor=bpy.app.version[1])\n" | ||||
| "\n" | "\n" | ||||
| " Return the base path for storing system files.\n" | " Return the base path for storing system files.\n" | ||||
| ▲ Show 20 Lines • Show All 196 Lines • Show Last 20 Lines | |||||
This changes the behavior of how the directories are selected, however since using an environment variable is such an obscure feature and people who use it most likely want it to be respected. It seems OK.