diff --git a/source/blender/blenkernel/intern/appdir.c b/source/blender/blenkernel/intern/appdir.c index e3c42c8bb78..7c409f1095b 100644 --- a/source/blender/blenkernel/intern/appdir.c +++ b/source/blender/blenkernel/intern/appdir.c @@ -460,18 +460,22 @@ static bool get_path_user_ex(char *targetpath, const bool check_is_dir) { char user_path[FILE_MAX]; - const char *user_base_path; - /* for portable install, user path is always local */ - if (BKE_appdir_app_is_portable_install()) { - return get_path_local_ex( - targetpath, targetpath_len, folder_name, subfolder_name, version, check_is_dir); + if (test_env_path(user_path, "BLENDER_USER_RESOURCES", check_is_dir)) { + /* Pass. */ } - user_path[0] = '\0'; + else { + /* for portable install, user path is always local */ + if (BKE_appdir_app_is_portable_install()) { + return get_path_local_ex( + targetpath, targetpath_len, folder_name, subfolder_name, version, check_is_dir); + } + user_path[0] = '\0'; - user_base_path = GHOST_getUserDir(version, blender_version_decimal(version)); - if (user_base_path) { - BLI_strncpy(user_path, user_base_path, FILE_MAX); + const char *user_base_path = GHOST_getUserDir(version, blender_version_decimal(version)); + if (user_base_path) { + BLI_strncpy(user_path, user_base_path, FILE_MAX); + } } if (!user_path[0]) { @@ -518,7 +522,6 @@ static bool get_path_system_ex(char *targetpath, const bool check_is_dir) { char system_path[FILE_MAX]; - const char *system_base_path; char relfolder[FILE_MAX]; if (folder_name) { /* `subfolder_name` may be NULL. */ @@ -528,10 +531,15 @@ static bool get_path_system_ex(char *targetpath, relfolder[0] = '\0'; } - system_path[0] = '\0'; - system_base_path = GHOST_getSystemDir(version, blender_version_decimal(version)); - if (system_base_path) { - BLI_strncpy(system_path, system_base_path, FILE_MAX); + if (test_env_path(system_path, "BLENDER_SYSTEM_RESOURCES", check_is_dir)) { + /* Pass. */ + } + else { + system_path[0] = '\0'; + const char *system_base_path = GHOST_getSystemDir(version, blender_version_decimal(version)); + if (system_base_path) { + BLI_strncpy(system_path, system_base_path, FILE_MAX); + } } if (!system_path[0]) { 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