Even though individual USER/SYSTEM paths could be set using environment variables,
it wasn't possible to override the USER or SYSTEM paths.
This meant the result of bpy.utils.resource_path('USER') & bpy.utils.resource_path('SYSTEM') could still be used by scripts, making the Blender session potentially the default USER directory (even when BLENDER_USER_CONFIG, BLENDER_USER_SCRIPTS & BLENDER_USER_DATAFILES all point elsewhere).
Resolve by adding environment variables:
- BLENDER_USER_RESOURCES
- BLENDER_SYSTEM_RESOURCES
These will be used for bpy.utils.resource_path('USER') & bpy.utils.resource_path('SYSTEM'), as well as a basis for user & system directories, unless those environment variables are set (BLENDER_USER_* or BLENDER_SYSTEM_*).
Resolves issue raised by T101389.
Example usage & output:
Note that this seems like a fairly straightforward change and reasonable not to have to define every sub-directory explicitly when overriding all, submitting for review in case there are details regarding it's implementation that could be changed.
I considered auto-detecting the base so if all BLENDER_USER_* shared a common root, that could automatically be used for BLENDER_USER_RESOURCES (same for SYSTEM...). But this seems too error prone, as it's possible only some environment variables are overridden making it unclear which root should be used - or, if we require all paths to be overridden - adding a new environment variable in the future would change the automatically selected resource-paths in a confusing & non-obvious way, so I think being explicit is the most straightforward solution.