diff options
author | Campbell Barton <ideasman42@gmail.com> | 2017-11-22 09:11:03 +0300 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2017-11-22 09:11:03 +0300 |
commit | 69b5165902d3e433af5b3ece633903162cbc292a (patch) | |
tree | 2617e76df85d8cfc53f77e161d38d716141c3f89 /source/blender/windowmanager | |
parent | d77f1d65380d9c3a80aafcccb3b59891bd56f63b (diff) |
WM: minor correction to user-pref writing
When saving templates had wrong return value.
Diffstat (limited to 'source/blender/windowmanager')
-rw-r--r-- | source/blender/windowmanager/intern/wm_files.c | 29 |
1 files changed, 16 insertions, 13 deletions
diff --git a/source/blender/windowmanager/intern/wm_files.c b/source/blender/windowmanager/intern/wm_files.c index e991e901bb1..97aa64a8dee 100644 --- a/source/blender/windowmanager/intern/wm_files.c +++ b/source/blender/windowmanager/intern/wm_files.c @@ -1472,7 +1472,7 @@ static int wm_userpref_write_exec(bContext *C, wmOperator *op) wmWindowManager *wm = CTX_wm_manager(C); char filepath[FILE_MAX]; const char *cfgdir; - bool ok = false; + bool ok = true; /* update keymaps in user preferences */ WM_keyconfig_update(wm); @@ -1482,31 +1482,34 @@ static int wm_userpref_write_exec(bContext *C, wmOperator *op) printf("trying to save userpref at %s ", filepath); if (BKE_blendfile_userdef_write(filepath, op->reports) != 0) { printf("ok\n"); - ok = true; } else { printf("fail\n"); + ok = false; } } else { BKE_report(op->reports, RPT_ERROR, "Unable to create userpref path"); } - if (U.app_template[0] && (cfgdir = BKE_appdir_folder_id_create(BLENDER_USER_CONFIG, U.app_template))) { - /* Also save app-template prefs */ - BLI_path_join(filepath, sizeof(filepath), cfgdir, BLENDER_USERPREF_FILE, NULL); - printf("trying to save app-template userpref at %s ", filepath); - if (BKE_blendfile_userdef_write(filepath, op->reports) == 0) { - printf("fail\n"); - ok = true; + if (U.app_template[0]) { + if ((cfgdir = BKE_appdir_folder_id_create(BLENDER_USER_CONFIG, U.app_template))) { + /* Also save app-template prefs */ + BLI_path_join(filepath, sizeof(filepath), cfgdir, BLENDER_USERPREF_FILE, NULL); + printf("trying to save app-template userpref at %s ", filepath); + if (BKE_blendfile_userdef_write(filepath, op->reports) != 0) { + printf("ok\n"); + } + else { + printf("fail\n"); + ok = false; + } } else { - printf("ok\n"); + BKE_report(op->reports, RPT_ERROR, "Unable to create app-template userpref path"); + ok = false; } } - else if (U.app_template[0]) { - BKE_report(op->reports, RPT_ERROR, "Unable to create app-template userpref path"); - } return ok ? OPERATOR_FINISHED : OPERATOR_CANCELLED; } |