Skip to content

Commit

Permalink
fixMoreBugs
Browse files Browse the repository at this point in the history
  • Loading branch information
iamapig120 committed Jan 23, 2019
1 parent 7d9b854 commit 86387bf
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 10 deletions.
23 changes: 14 additions & 9 deletions configs.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,13 @@
const os = require('os')
const fs = require('fs')
const { app } = require('electron')
const electron = require('electron')
const path = require('path')

let app = electron.app
if (!app) {
app = electron.remote.app
}

const getIcon = () => {
switch (os.platform()) {
case 'win32':
Expand All @@ -24,12 +29,12 @@ const CONFIGS = {
MODS_DIR: '/mod',
MODS_CONFIG_PATH: path.join(app.getPath('userData'), 'modsEnabled.json'),
PLUGINS_DIR: '/plugin',
PLUGINS_CONFIG_PATH: path.join(
app.getPath('userData'),
'pluginsEnabled.json'
),
TOOLS_DIR: '/tool',
EXECUTES_DIR: '/execute',
EXECUTES_CONFIG_PATH: path.join(
app.getPath('userData'),
'executesEnabled.json'
),
USER_CONFIG_PATH: path.join(app.getPath('userData'), 'configs-user.json'),
GAME_WINDOW_CONFIG: {
width: 1280,
Expand Down Expand Up @@ -83,18 +88,18 @@ const CONFIGS = {
}
}
try {
fs.statSync(CONFIGS.PLUGINS_CONFIG_PATH)
fs.statSync(CONFIGS.EXECUTES_CONFIG_PATH)
} catch (error) {
fs.copyFileSync(
path.join(__dirname, CONFIGS.PLUGINS_DIR, 'active.json'),
CONFIGS.PLUGINS_CONFIG_PATH
path.join(__dirname, CONFIGS.EXECUTES_DIR, 'active.json'),
CONFIGS.EXECUTES_CONFIG_PATH
)
}
try {
fs.statSync(CONFIGS.MODS_CONFIG_PATH)
} catch (error) {
fs.copyFileSync(
path.join(__dirname, CONFIGS.MODS_CONFIG_PATH, 'active.json'),
path.join(__dirname, CONFIGS.MODS_DIR, 'active.json'),
CONFIGS.MODS_CONFIG_PATH
)
}
Expand Down
2 changes: 1 addition & 1 deletion manager/manager.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ const app = electronRemote.app
// 注入脚本根文件根目录
const executeRootDir = path.join(__dirname, '../', configs.EXECUTES_DIR)
// const executeSettingsFile = path.join(executeRootDir, './active.json')
const executeSettingsFile = configs.PLUGINS_CONFIG_PATH
const executeSettingsFile = configs.EXECUTES_CONFIG_PATH

// Mod文件根目录
const modRootDir = path.join(__dirname, '../', configs.MODS_DIR)
Expand Down

0 comments on commit 86387bf

Please sign in to comment.