fix(windows): resolve some encoding problem with search daemon process
This commit is contained in:
@ -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)
|
||||
|
Reference in New Issue
Block a user