Skip to content

Commit 9c1f00e

Browse files
committed
Fix first launch dictionary load
1 parent 6741847 commit 9c1f00e

File tree

1 file changed

+21
-9
lines changed

1 file changed

+21
-9
lines changed

src/js/main/User.js

Lines changed: 21 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -46,18 +46,10 @@ function User(name, factory) {
4646

4747
// Watch files for changes
4848
fs.watchFile(this.paths.conf + '/' + 'oryoki-preferences.json', this.onPreferencesChange.bind(this));
49-
this.onPreferencesChange();
5049

5150
fs.watchFile(this.paths.conf + '/' + 'search-dictionary.json', function() {
52-
// @if NODE_ENV='development'
53-
c.log('[User] Search dictionary has changed');
54-
// @endif
55-
this.searchDictionary = this.getConfFile('search-dictionary.json', this.createSearchDictionary.bind(this));
5651

57-
// Update accross all windows
58-
for (var i = 0; i < Oryoki.windows.length; i++) {
59-
Oryoki.windows[i].updateConfFiles();
60-
}
52+
this.onSearchDictionaryChange();
6153

6254
if(Oryoki.focusedWindow) {
6355
Oryoki.focusedWindow.browser.webContents.send('log-status', {
@@ -67,6 +59,26 @@ function User(name, factory) {
6759

6860
}.bind(this));
6961

62+
// Init conf file
63+
this.onPreferencesChange();
64+
this.onSearchDictionaryChange();
65+
66+
}
67+
68+
User.prototype.onSearchDictionaryChange = function() {
69+
70+
// @if NODE_ENV='development'
71+
c.log('[User] Search dictionary has changed');
72+
// @endif
73+
this.searchDictionary = this.getConfFile('search-dictionary.json', this.createSearchDictionary.bind(this));
74+
75+
// Update accross all windows
76+
if(Oryoki.focusedWindow) {
77+
for (var i = 0; i < Oryoki.windows.length; i++) {
78+
Oryoki.windows[i].updateConfFiles();
79+
}
80+
}
81+
7082
}
7183

7284
User.prototype.onPreferencesChange = function() {

0 commit comments

Comments
 (0)