Skip to content

Commit

Permalink
fix(windows): resolve some encoding problem with search daemon process
Browse files Browse the repository at this point in the history
  • Loading branch information
DEgITx committed Feb 6, 2018
1 parent 2a6bfd1 commit 91c99d1
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
6 changes: 5 additions & 1 deletion src/background/background.js
Original file line number Diff line number Diff line change
Expand Up @@ -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];
Expand Down Expand Up @@ -93,7 +94,7 @@ const getSphinxPath = () => {
}

const writeSphinxConfig = (path, dbPath) => {
const config = `
let config = `
index torrents
{
type = rt
Expand Down Expand Up @@ -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)
Expand Down

0 comments on commit 91c99d1

Please sign in to comment.