diff --git a/package.json b/package.json index 6a13490..f79ad28 100644 --- a/package.json +++ b/package.json @@ -75,6 +75,7 @@ "debug": "^3.1.0", "diskusage": "^0.2.4", "fs-jetpack": "^1.2.0", + "iconv-lite": "^0.4.19", "ipaddr.js": "^1.5.4", "material-ui": "^0.20.0", "moment": "^2.20.1", diff --git a/src/background/background.js b/src/background/background.js index 43643c6..ea2edf3 100644 --- a/src/background/background.js +++ b/src/background/background.js @@ -19,6 +19,7 @@ import env from "env"; const { spawn, exec } = require('child_process') const fs = require('fs') +const iconv = require('iconv-lite'); const setApplicationMenu = () => { const menus = [editMenuTemplate, settingsMenuTemplate, aboutMenuTemplate]; @@ -93,7 +94,7 @@ const getSphinxPath = () => { } const writeSphinxConfig = (path, dbPath) => { - const config = ` + let config = ` index torrents { type = rt @@ -182,6 +183,9 @@ const writeSphinxConfig = (path, dbPath) => { fs.mkdirSync(`${dbPath}/database`); } + if(/^win/.test(process.platform)) + config = iconv.encode(config, 'win1251') + fs.writeFileSync(`${path}/sphinx.conf`, config) console.log(`writed sphinx config to ${path}`) console.log('db path:', dbPath)