1
0
mirror of https://github.com/laurent22/joplin.git synced 2024-12-24 10:27:10 +02:00

Fixed setting initialisation issue

This commit is contained in:
Laurent Cozic 2017-10-09 21:29:49 +01:00
parent 8c7cd8de88
commit 4edef57764
2 changed files with 12 additions and 7 deletions

View File

@ -344,7 +344,7 @@ class AppGui {
if (name === 'CTRL_C' ) {
termutils.showCursor(term);
term.fullscreen(false);
process.exit();
await this.app().exit();
return;
}

View File

@ -296,6 +296,11 @@ class Application {
return cmd;
}
async exit(code = 0) {
await Setting.saveAll();
process.exit(code);
}
commands() {
if (this.allCommandsLoaded_) return this.commands_;
@ -462,7 +467,7 @@ class Application {
this.dbLogger_.setLevel(initArgs.logLevel);
if (Setting.value('env') === 'dev') {
this.dbLogger_.setLevel(Logger.LEVEL_WARN);
this.dbLogger_.setLevel(Logger.LEVEL_DEBUG);
}
const packageJson = require('./package.json');
@ -470,13 +475,17 @@ class Application {
this.logger_.info('Profile directory: ' + profileDir);
this.database_ = new JoplinDatabase(new DatabaseDriverNode());
//this.database_.setLogExcludedQueryTypes(['SELECT']);
this.database_.setLogger(this.dbLogger_);
this.database_.setLogExcludedQueryTypes(['SELECT']);
await this.database_.open({ name: profileDir + '/database.sqlite' });
reg.setDb(this.database_);
BaseModel.db_ = this.database_;
this.store_ = createStore(reducer, applyMiddleware(this.generalMiddleware()));
BaseModel.dispatch = this.store().dispatch;
FoldersScreenUtils.dispatch = this.store().dispatch;
await Setting.load();
if (Setting.value('firstStart')) {
@ -497,10 +506,6 @@ class Application {
if (!this.currentFolder_) this.currentFolder_ = await Folder.defaultFolder();
Setting.setValue('activeFolderId', this.currentFolder_ ? this.currentFolder_.id : '');
this.store_ = createStore(reducer, applyMiddleware(this.generalMiddleware()));
BaseModel.dispatch = this.store().dispatch;
FoldersScreenUtils.dispatch = this.store().dispatch;
const AppGui = require('./app-gui.js');
this.gui_ = new AppGui(this, this.store());
this.gui_.setLogger(this.logger_);