Cleanup: remove BLENDER_USER_AUTOSAVE
This was only used on WIN32 when the temporary directory didn't exist.
When the check was added [0] this made some sense because it relied on
`U.tempdir` existing, since then additional checks have been added to
ensure a temporary directory can be used. Further, this fall-back
location isn't documented in the user manual.
[0]: 615db01b01
This commit is contained in:
@@ -739,7 +739,7 @@ def user_resource(resource_type, *, path="", create=False):
|
||||
"""
|
||||
Return a user resource path (normally from the users home directory).
|
||||
|
||||
:arg type: Resource type in ['DATAFILES', 'CONFIG', 'SCRIPTS', 'AUTOSAVE'].
|
||||
:arg type: Resource type in ['DATAFILES', 'CONFIG', 'SCRIPTS'].
|
||||
:type type: string
|
||||
:arg path: Optional subdirectory.
|
||||
:type path: string
|
||||
|
||||
@@ -96,7 +96,6 @@ def write_sysinfo(filepath):
|
||||
output.write("datafiles: %r\n" % (bpy.utils.user_resource('DATAFILES')))
|
||||
output.write("config: %r\n" % (bpy.utils.user_resource('CONFIG')))
|
||||
output.write("scripts: %r\n" % (bpy.utils.user_resource('SCRIPTS')))
|
||||
output.write("autosave: %r\n" % (bpy.utils.user_resource('AUTOSAVE')))
|
||||
output.write("tempdir: %r\n" % (bpy.app.tempdir))
|
||||
|
||||
output.write(title("FFmpeg"))
|
||||
|
||||
@@ -168,7 +168,6 @@ enum {
|
||||
BLENDER_USER_CONFIG = 31,
|
||||
BLENDER_USER_DATAFILES = 32,
|
||||
BLENDER_USER_SCRIPTS = 33,
|
||||
BLENDER_USER_AUTOSAVE = 34,
|
||||
|
||||
/* system */
|
||||
BLENDER_SYSTEM_DATAFILES = 52,
|
||||
|
||||
@@ -626,15 +626,6 @@ bool BKE_appdir_folder_id_ex(const int folder_id,
|
||||
}
|
||||
return false;
|
||||
|
||||
case BLENDER_USER_AUTOSAVE:
|
||||
if (get_path_environment(path, path_maxncpy, subfolder, "BLENDER_USER_DATAFILES")) {
|
||||
break;
|
||||
}
|
||||
if (get_path_user(path, path_maxncpy, "autosave", subfolder)) {
|
||||
break;
|
||||
}
|
||||
return false;
|
||||
|
||||
case BLENDER_USER_CONFIG:
|
||||
if (get_path_environment(path, path_maxncpy, subfolder, "BLENDER_USER_CONFIG")) {
|
||||
break;
|
||||
@@ -718,14 +709,6 @@ std::optional<std::string> BKE_appdir_folder_id_user_notest(const int folder_id,
|
||||
}
|
||||
get_path_user_ex(path, sizeof(path), "config", subfolder, version, check_is_dir);
|
||||
break;
|
||||
case BLENDER_USER_AUTOSAVE:
|
||||
if (get_path_environment_ex(
|
||||
path, sizeof(path), subfolder, "BLENDER_USER_AUTOSAVE", check_is_dir))
|
||||
{
|
||||
break;
|
||||
}
|
||||
get_path_user_ex(path, sizeof(path), "autosave", subfolder, version, check_is_dir);
|
||||
break;
|
||||
case BLENDER_USER_SCRIPTS:
|
||||
if (get_path_environment_ex(
|
||||
path, sizeof(path), subfolder, "BLENDER_USER_SCRIPTS", check_is_dir))
|
||||
@@ -748,12 +731,7 @@ std::optional<std::string> BKE_appdir_folder_id_user_notest(const int folder_id,
|
||||
std::optional<std::string> BKE_appdir_folder_id_create(const int folder_id, const char *subfolder)
|
||||
{
|
||||
/* Only for user folders. */
|
||||
if (!ELEM(folder_id,
|
||||
BLENDER_USER_DATAFILES,
|
||||
BLENDER_USER_CONFIG,
|
||||
BLENDER_USER_SCRIPTS,
|
||||
BLENDER_USER_AUTOSAVE))
|
||||
{
|
||||
if (!ELEM(folder_id, BLENDER_USER_DATAFILES, BLENDER_USER_CONFIG, BLENDER_USER_SCRIPTS)) {
|
||||
BLI_assert_unreachable();
|
||||
return std::nullopt;
|
||||
}
|
||||
|
||||
@@ -223,7 +223,6 @@ static PyObject *bpy_user_resource(PyObject * /*self*/, PyObject *args, PyObject
|
||||
{BLENDER_USER_DATAFILES, "DATAFILES"},
|
||||
{BLENDER_USER_CONFIG, "CONFIG"},
|
||||
{BLENDER_USER_SCRIPTS, "SCRIPTS"},
|
||||
{BLENDER_USER_AUTOSAVE, "AUTOSAVE"},
|
||||
{0, nullptr},
|
||||
};
|
||||
PyC_StringEnum type = {type_items};
|
||||
|
||||
@@ -2098,20 +2098,6 @@ static void wm_autosave_location(char filepath[FILE_MAX])
|
||||
}
|
||||
|
||||
const char *tempdir_base = BKE_tempdir_base();
|
||||
/* NOTE(@ideasman42): It's strange that this is only used on WIN32.
|
||||
* From reading commits it seems accessing the temporary directory used to be less reliable.
|
||||
* If this is still the case on WIN32 - other features such as copy-paste will also fail.
|
||||
* We could support #BLENDER_USER_AUTOSAVE on all platforms or remove it entirely. */
|
||||
#ifdef WIN32
|
||||
std::optional<std::string> savedir;
|
||||
if (!BLI_exists(tempdir_base)) {
|
||||
savedir = BKE_appdir_folder_id_create(BLENDER_USER_AUTOSAVE, nullptr);
|
||||
if (savedir.has_value()) {
|
||||
tempdir_base = savedir->c_str();
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
BLI_path_join(filepath, FILE_MAX, tempdir_base, filename);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user