Fix T62736: Inconsistent behavior bpy.utils.user_resource()

If a subfolder was specified which didn't exist, logic would fallback
to get_path_user (instead of get_path_environment).

Now always use the from the environment variable if it's set and exists.
This commit is contained in:
2019-03-20 15:17:32 +11:00
committed by Campbell Barton
parent 4e2aea5efe
commit fe7c7d2820
2 changed files with 35 additions and 9 deletions

View File

@@ -167,10 +167,7 @@ static PyObject *bpy_user_resource(PyObject *UNUSED(self), PyObject *args, PyObj
}
/* 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);
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 : "");
}