Changeset View
Changeset View
Standalone View
Standalone View
source/blender/blenkernel/intern/appdir.c
| Show First 20 Lines • Show All 454 Lines • ▼ Show 20 Lines | |||||
| static bool get_path_user_ex(char *targetpath, | static bool get_path_user_ex(char *targetpath, | ||||
| size_t targetpath_len, | size_t targetpath_len, | ||||
| const char *folder_name, | const char *folder_name, | ||||
| const char *subfolder_name, | const char *subfolder_name, | ||||
| const int version, | const int version, | ||||
| const bool check_is_dir) | const bool check_is_dir) | ||||
| { | { | ||||
| char user_path[FILE_MAX]; | char user_path[FILE_MAX]; | ||||
| const char *user_base_path; | |||||
| if (test_env_path(user_path, "BLENDER_RESOURCE_PATH_USER", check_is_dir)) { | |||||
| /* Pass. */ | |||||
| } | |||||
| else { | |||||
| /* for portable install, user path is always local */ | /* for portable install, user path is always local */ | ||||
| if (BKE_appdir_app_is_portable_install()) { | if (BKE_appdir_app_is_portable_install()) { | ||||
| return get_path_local_ex( | return get_path_local_ex( | ||||
| targetpath, targetpath_len, folder_name, subfolder_name, version, check_is_dir); | targetpath, targetpath_len, folder_name, subfolder_name, version, check_is_dir); | ||||
| } | } | ||||
| user_path[0] = '\0'; | user_path[0] = '\0'; | ||||
| user_base_path = GHOST_getUserDir(version, blender_version_decimal(version)); | const char *user_base_path = GHOST_getUserDir(version, blender_version_decimal(version)); | ||||
| if (user_base_path) { | if (user_base_path) { | ||||
| BLI_strncpy(user_path, user_base_path, FILE_MAX); | BLI_strncpy(user_path, user_base_path, FILE_MAX); | ||||
| } | } | ||||
| } | |||||
| if (!user_path[0]) { | if (!user_path[0]) { | ||||
| return false; | return false; | ||||
| } | } | ||||
| CLOG_INFO(&LOG, | CLOG_INFO(&LOG, | ||||
| 3, | 3, | ||||
| "'%s', folder='%s', subfolder='%s'", | "'%s', folder='%s', subfolder='%s'", | ||||
| Show All 29 Lines | |||||
| static bool get_path_system_ex(char *targetpath, | static bool get_path_system_ex(char *targetpath, | ||||
| size_t targetpath_len, | size_t targetpath_len, | ||||
| const char *folder_name, | const char *folder_name, | ||||
| const char *subfolder_name, | const char *subfolder_name, | ||||
| const int version, | const int version, | ||||
| const bool check_is_dir) | const bool check_is_dir) | ||||
| { | { | ||||
| char system_path[FILE_MAX]; | char system_path[FILE_MAX]; | ||||
| const char *system_base_path; | |||||
| char relfolder[FILE_MAX]; | char relfolder[FILE_MAX]; | ||||
| if (folder_name) { /* `subfolder_name` may be NULL. */ | if (folder_name) { /* `subfolder_name` may be NULL. */ | ||||
| BLI_path_join(relfolder, sizeof(relfolder), folder_name, subfolder_name, NULL); | BLI_path_join(relfolder, sizeof(relfolder), folder_name, subfolder_name, NULL); | ||||
| } | } | ||||
| else { | else { | ||||
| relfolder[0] = '\0'; | relfolder[0] = '\0'; | ||||
| } | } | ||||
| if (test_env_path(system_path, "BLENDER_RESOURCE_PATH_SYSTEM", check_is_dir)) { | |||||
| /* Pass. */ | |||||
| } | |||||
| else { | |||||
| system_path[0] = '\0'; | system_path[0] = '\0'; | ||||
| system_base_path = GHOST_getSystemDir(version, blender_version_decimal(version)); | const char *system_base_path = GHOST_getSystemDir(version, blender_version_decimal(version)); | ||||
| if (system_base_path) { | if (system_base_path) { | ||||
| BLI_strncpy(system_path, system_base_path, FILE_MAX); | BLI_strncpy(system_path, system_base_path, FILE_MAX); | ||||
| } | } | ||||
| } | |||||
| if (!system_path[0]) { | if (!system_path[0]) { | ||||
| return false; | return false; | ||||
| } | } | ||||
| CLOG_INFO(&LOG, | CLOG_INFO(&LOG, | ||||
| 3, | 3, | ||||
| "'%s', folder='%s', subfolder='%s'", | "'%s', folder='%s', subfolder='%s'", | ||||
| ▲ Show 20 Lines • Show All 647 Lines • Show Last 20 Lines | |||||