Skip to content

Commit

Permalink
Mac path compatibility
Browse files Browse the repository at this point in the history
  • Loading branch information
AdamGaskins committed Sep 2, 2019
1 parent 2b88b9d commit a79dfc2
Showing 1 changed file with 20 additions and 1 deletion.
21 changes: 20 additions & 1 deletion src/renderer/Config.js
Original file line number Diff line number Diff line change
@@ -1,16 +1,35 @@
import fs from 'fs'
import path from 'path'
import os from 'os'
import { remote } from 'electron'

export default class Config {
constructor() {
this.fileName = 'config.json'
if (os.platform() === 'darwin') {
this.fileName = path.join(
remote.app.getPath('userData'),
'config.json'
)
}
this.data = {}
if (fs.existsSync(this.fileName))
this.data = JSON.parse(fs.readFileSync(this.fileName))

if (!this.has('version')) this.set('version', '0.0.0')
if (!this.has('launch'))
this.set('launch', ['Atmosphir_Data/Atmosphir.exe', 'standalone'])
if (!this.has('asset_path')) this.set('asset_path', 'game/')
if (!this.has('asset_path')) {
if (os.platform() === 'darwin') {
this.set(
'asset_path',
path.join(remote.app.getPath('userData', 'game') + '/')
)
} else {
this.set('asset_path', 'game/')
}
}
console.log(remote.app.getPath('userData'))
if (!this.has('server')) {
if (process.env.NODE_ENV === 'production')
this.set(
Expand Down

0 comments on commit a79dfc2

Please sign in to comment.