Commit: 79774aa68ce3f33547b0daf928874a13218d2aee
Author: Campbell Barton
Date: Wed Oct 5 15:30:44 2022 +1100
Branches: master
https://developer.blender.org/rB79774aa68ce3f33547b0daf928874a13218d2aee
App Template: quiet warning when existing preferences don't exist
Suppress warning when saving app-template preferences.
Check if the preferences exist before attempting to read them,
while harmless it looked as if something went wrong.
===================================================================
M source/blender/blenkernel/intern/blendfile.c
===================================================================
diff --git a/source/blender/blenkernel/intern/blendfile.c
b/source/blender/blenkernel/intern/blendfile.c
index f5b385b1682..4601fc1fc3a 100644
--- a/source/blender/blenkernel/intern/blendfile.c
+++ b/source/blender/blenkernel/intern/blendfile.c
@@ -16,6 +16,7 @@
#include "DNA_screen_types.h"
#include "DNA_workspace_types.h"
+#include "BLI_fileops.h"
#include "BLI_listbase.h"
#include "BLI_path_util.h"
#include "BLI_string.h"
@@ -711,8 +712,13 @@ bool BKE_blendfile_userdef_write(const char *filepath,
ReportList *reports)
bool BKE_blendfile_userdef_write_app_template(const char *filepath, ReportList
*reports)
{
- /* if it fails, overwrite is OK. */
- UserDef *userdef_default = BKE_blendfile_userdef_read(filepath, NULL);
+ /* Checking that `filepath` exists is not essential, it just avoids printing
a warning that
+ * the file can't be found. In this case it's not an error - as the file is
used if it exists,
+ * falling back to the defaults.
+ * If the preferences exists but file reading fails - the file can be
assumed corrupt
+ * so overwriting the file is OK. */
+ UserDef *userdef_default = BLI_exists(filepath) ?
BKE_blendfile_userdef_read(filepath, NULL) :
+ NULL;
if (userdef_default == NULL) {
return BKE_blendfile_userdef_write(filepath, reports);
}
_______________________________________________
Bf-blender-cvs mailing list
[email protected]
List details, subscription details or unsubscribe:
https://lists.blender.org/mailman/listinfo/bf-blender-cvs