Fix error on Linux

This commit is contained in:
cutls 2019-10-08 22:04:51 +09:00
parent 7ac0889b78
commit 44ccd111b2

View File

@ -92,10 +92,14 @@ function css(mainWindow) {
}) })
ipc.on('theme-json-list', function (e, arg) { ipc.on('theme-json-list', function (e, arg) {
fs.readdir(app.getPath("userData"), function (err, files) { fs.readdir(app.getPath("userData"), function (err, files) {
if (err) throw err; if (err || !files) throw err;
var fileList = files.filter(function (file) { var fileList = files.filter(function (file) {
var tfile = join(app.getPath("userData"), file); if(file.match(/\.thedesktheme$/)){
return fs.statSync(tfile).isFile() && /.*\.thedesktheme$/.test(tfile); //絞り込み var tfile = join(app.getPath("userData"), file)
return fs.statSync(tfile).isFile() && /.*\.thedesktheme$/.test(tfile)
}else{
return null
}
}) })
var themes = []; var themes = [];
for (var i = 0; i < fileList.length; i++) { for (var i = 0; i < fileList.length; i++) {