diff options
author | Campbell Barton <campbell@blender.org> | 2022-10-04 05:54:09 +0300 |
---|---|---|
committer | Campbell Barton <campbell@blender.org> | 2022-10-04 05:54:09 +0300 |
commit | bf4926b30c6fc7b9f98dde508b7b644feaf21022 (patch) | |
tree | 6d79bbef18525e93dcf2ef7f9d9f1006d97e793a /source/creator | |
parent | 868ef9ec37a9dd4856a8a034f7e3865cf4252b1d (diff) |
Support environment variables to override USER & SYSTEM resource paths
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:
{P3225}
Reviewed By: brecht
Ref D16111
Diffstat (limited to 'source/creator')
-rw-r--r-- | source/creator/creator_args.c | 18 |
1 files changed, 12 insertions, 6 deletions
diff --git a/source/creator/creator_args.c b/source/creator/creator_args.c index e0fea8a4686..06b898587bf 100644 --- a/source/creator/creator_args.c +++ b/source/creator/creator_args.c @@ -656,12 +656,18 @@ static int arg_handle_print_help(int UNUSED(argc), const char **UNUSED(argv), vo printf("\t...works as expected.\n\n"); printf("Environment Variables:\n"); - printf(" $BLENDER_USER_CONFIG Directory for user configuration files.\n"); - printf(" $BLENDER_USER_SCRIPTS Directory for user scripts.\n"); - printf(" $BLENDER_SYSTEM_SCRIPTS Directory for system wide scripts.\n"); - printf(" $BLENDER_USER_DATAFILES Directory for user data files (icons, translations, ..).\n"); - printf(" $BLENDER_SYSTEM_DATAFILES Directory for system wide data files.\n"); - printf(" $BLENDER_SYSTEM_PYTHON Directory for system Python libraries.\n"); + printf(" $BLENDER_USER_RESOURCES Top level directory for user files.\n"); + printf(" (other 'BLENDER_USER_*' variables override when set).\n"); + printf(" $BLENDER_USER_CONFIG Directory for user configuration files.\n"); + printf(" $BLENDER_USER_SCRIPTS Directory for user scripts.\n"); + printf(" $BLENDER_USER_DATAFILES Directory for user data files (icons, translations, ..).\n"); + printf("\n"); + printf(" $BLENDER_SYSTEM_RESOURCES Top level directory for system files.\n"); + printf(" (other 'BLENDER_SYSTEM_*' variables override when set).\n"); + printf(" $BLENDER_SYSTEM_SCRIPTS Directory for system wide scripts.\n"); + printf(" $BLENDER_SYSTEM_DATAFILES Directory for system wide data files.\n"); + printf(" $BLENDER_SYSTEM_PYTHON Directory for system Python libraries.\n"); + # ifdef WITH_OCIO printf(" $OCIO Path to override the OpenColorIO config file.\n"); # endif |