Core: Change portable install folder to portable/ #122778

Merged
Brecht Van Lommel merged 1 commits from brecht/blender:portable into blender-v4.2-release 2024-06-05 18:36:24 +02:00
3 changed files with 17 additions and 33 deletions

View File

@ -100,11 +100,6 @@ std::optional<std::string> BKE_appdir_resource_path_id_with_version(int folder_i
int version);
std::optional<std::string> BKE_appdir_resource_path_id(int folder_id, bool check_is_dir);
/**
* Check if this is an install with user files kept together
* with the Blender executable and its installation files.
*/
bool BKE_appdir_app_is_portable_install();
/**
* Return true if templates exist
*/

View File

@ -391,8 +391,8 @@ static bool get_path_local_ex(char *targetpath,
targetpath_maxncpy,
check_is_dir,
path_base,
blender_version_decimal(version),
relfolder);
(version) ? blender_version_decimal(version) : relfolder,
(version) ? relfolder : nullptr);
}
static bool get_path_local(char *targetpath,
size_t targetpath_maxncpy,
@ -405,13 +405,6 @@ static bool get_path_local(char *targetpath,
targetpath, targetpath_maxncpy, folder_name, subfolder_name, version, check_is_dir);
}
bool BKE_appdir_app_is_portable_install()
{
/* Detect portable install by the existence of `config` folder. */
char dirpath[FILE_MAX];
return get_path_local(dirpath, sizeof(dirpath), "config", nullptr);
}
/**
* Returns the path of a folder from environment variables.
*
@ -465,15 +458,15 @@ static bool get_path_user_ex(char *targetpath,
{
char user_path[FILE_MAX];
/* Environment variable override. */
if (test_env_path(user_path, "BLENDER_USER_RESOURCES", check_is_dir)) {
/* Pass. */
}
/* Portable install, to store user files next to Blender executable. */
else if (get_path_local_ex(user_path, sizeof(user_path), "portable", nullptr, 0, true)) {
/* Pass. */
}
else {
/* for portable install, user path is always local */
if (BKE_appdir_app_is_portable_install()) {
return get_path_local_ex(
targetpath, targetpath_maxncpy, folder_name, subfolder_name, version, check_is_dir);
}
user_path[0] = '\0';
const char *user_base_path = GHOST_getUserDir(version, blender_version_decimal(version));

View File

@ -840,21 +840,17 @@ void BKE_studiolight_init()
BLI_addtail(&studiolights, sl);
/* Go over the preset folder and add a studio-light for every image with its path. */
/* For portable installs (where USER and SYSTEM paths are the same),
* only go over LOCAL data-files once. */
/* Also reserve icon space for it. */
if (!BKE_appdir_app_is_portable_install()) {
studiolight_add_files_from_datafolder(BLENDER_USER_DATAFILES,
STUDIOLIGHT_LIGHTS_FOLDER,
STUDIOLIGHT_TYPE_STUDIO | STUDIOLIGHT_USER_DEFINED |
STUDIOLIGHT_SPECULAR_HIGHLIGHT_PASS);
studiolight_add_files_from_datafolder(BLENDER_USER_DATAFILES,
STUDIOLIGHT_WORLD_FOLDER,
STUDIOLIGHT_TYPE_WORLD | STUDIOLIGHT_USER_DEFINED);
studiolight_add_files_from_datafolder(BLENDER_USER_DATAFILES,
STUDIOLIGHT_MATCAP_FOLDER,
STUDIOLIGHT_TYPE_MATCAP | STUDIOLIGHT_USER_DEFINED);
}
studiolight_add_files_from_datafolder(BLENDER_USER_DATAFILES,
STUDIOLIGHT_LIGHTS_FOLDER,
STUDIOLIGHT_TYPE_STUDIO | STUDIOLIGHT_USER_DEFINED |
STUDIOLIGHT_SPECULAR_HIGHLIGHT_PASS);
studiolight_add_files_from_datafolder(BLENDER_USER_DATAFILES,
STUDIOLIGHT_WORLD_FOLDER,
STUDIOLIGHT_TYPE_WORLD | STUDIOLIGHT_USER_DEFINED);
studiolight_add_files_from_datafolder(BLENDER_USER_DATAFILES,
STUDIOLIGHT_MATCAP_FOLDER,
STUDIOLIGHT_TYPE_MATCAP | STUDIOLIGHT_USER_DEFINED);
studiolight_add_files_from_datafolder(BLENDER_SYSTEM_DATAFILES,
STUDIOLIGHT_LIGHTS_FOLDER,
STUDIOLIGHT_TYPE_STUDIO |