Skip to content
This repository was archived by the owner on Feb 5, 2021. It is now read-only.

Commit ad1a37f

Browse files
author
Howard Ju
committed
Fix the error when first run application due to user data folder doesn't exist.
1 parent f8605ee commit ad1a37f

File tree

2 files changed

+3
-2
lines changed

2 files changed

+3
-2
lines changed

src/controller/app-tray-controller.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,11 @@
11
const path = require('path');
22
const { app, Menu, nativeImage, Tray, ipcMain, Notification } = require('electron');
33
const storage = require('electron-json-storage');
4+
const fs = require('fs-extra');
45
const settings = require('electron-settings');
56
const { download } = require('electron-dl');
67

7-
const language = settings.get('language', 'en');
8+
const language = fs.existsSync(`${app.getPath('userData')}/Settings`) ? settings.get('language', 'en') : 'en';
89
const Locale = language === 'en' ? require('../locale/locale_en') : require('../locale/locale_sc');
910
const macOS = process.platform === 'darwin' ? true : false;
1011

src/controller/player-controller.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ const playerUrl = 'http://www.xiami.com/play';
1515
const playlistUrl = 'http://www.xiami.com/song/playlist';
1616
const getLyricUrl = 'http://img.xiami.net/lyric/';
1717

18-
const language = settings.get('language', 'en');
18+
const language = fs.existsSync(`${app.getPath('userData')}/Settings`) ? settings.get('language', 'en') : 'en';
1919
const Locale = language === 'en' ? require('../locale/locale_en') : require('../locale/locale_sc');
2020

2121
class XiamiPlayer {

0 commit comments

Comments
 (0)