Skip to content

Commit

Permalink
Fix #25
Browse files Browse the repository at this point in the history
Brackets doesn't provide file contents (._contents property) if the files are not in a watched directory. This fixes #25 by providing an instruction to the user instead of silently failing to show the comparison.
  • Loading branch information
anton-bot authored Jul 5, 2016
1 parent a442ebd commit af1e75f
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion src/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,12 @@ define(function (require, exports, module) {
return;
}

if (mFile._contents === null || oFile._contents === null) {
notifier.error('To compare files, please open the folder containing these files in Brackets using the pane on the left.');
Logger.error('To compare files, please open the folder containing these files in Brackets using the pane on the left.');
return;
}

if (getExtension(mFile._name) !== getExtension(oFile._name)) {
notifier.error('Cannot compare files of different types. Please select files of the same type.');
Logger.error('Cannot compare files of different types. Please select files of the same type.');
Expand Down Expand Up @@ -152,4 +158,4 @@ define(function (require, exports, module) {
// Create a new panel to hold the diff views
comparePanel = WorkspaceManager.createBottomPanel("compare.panel", $(COMPARE_PANEL_HTML), 1000);
});
});
});

0 comments on commit af1e75f

Please sign in to comment.