From 9afe56cea3b5b28781b2532388bf17f3c83a1eab Mon Sep 17 00:00:00 2001 From: Arzhan Kinzhalin Date: Tue, 25 Nov 2014 23:10:35 -0300 Subject: [PATCH] Fix #9975. --- src/brackets.js | 23 +++++++++++++++++------ 1 file changed, 17 insertions(+), 6 deletions(-) diff --git a/src/brackets.js b/src/brackets.js index e0d5e728334..b0371945fdd 100644 --- a/src/brackets.js +++ b/src/brackets.js @@ -291,13 +291,24 @@ define(function (require, exports, module) { PerfUtils.addMeasurement("Application Startup"); if (PreferencesManager._isUserScopeCorrupt()) { - Dialogs.showModalDialog( - DefaultDialogs.DIALOG_ID_ERROR, - Strings.ERROR_PREFS_CORRUPT_TITLE, - Strings.ERROR_PREFS_CORRUPT - ) + var userPrefFullPath = PreferencesManager.getUserPrefFile(); + // user scope can get corrupt only if the file exists, is readable, + // but malformed. no need to check for its existance. + var info = MainViewManager.findInAllWorkingSets(userPrefFullPath); + var paneId; + if (info.length) { + paneId = info[0].paneId; + } + FileViewController.openFileAndAddToWorkingSet(userPrefFullPath, paneId) .done(function () { - CommandManager.execute(Commands.FILE_OPEN_PREFERENCES); + Dialogs.showModalDialog( + DefaultDialogs.DIALOG_ID_ERROR, + Strings.ERROR_PREFS_CORRUPT_TITLE, + Strings.ERROR_PREFS_CORRUPT + ).done(function () { + // give the focus back to the editor with the pref file + MainViewManager.focusActivePane(); + }); }); }