settings are stored in home dir
This commit is contained in:
parent
3f5e51e4b5
commit
0cd31c48e5
1 changed files with 5 additions and 2 deletions
|
|
@ -1,6 +1,9 @@
|
|||
// This prevents argv parsing to be breaked when the app is packaged (executed without 'electron' prefix)
|
||||
if (process.argv[1]&&process.argv[1].indexOf('-')==0) process.argv.unshift('')
|
||||
|
||||
var baseDir = process.env[(process.platform == 'win32') ? 'USERPROFILE' : 'HOME'],
|
||||
configFile = require('path').join(baseDir, '.open-stage-control')
|
||||
|
||||
var argv = require('yargs')
|
||||
.help('help').usage(`\nUsage:\n $0 [options]`).alias('h', 'help')
|
||||
.options({
|
||||
|
|
@ -31,7 +34,7 @@ module.exports = function(fs) {
|
|||
noGui: argv.n || false,
|
||||
|
||||
|
||||
persistent: function(){var c = {};try {c=require( __dirname + '/config.json')} finally {return c}}(),
|
||||
persistent: function(){var c = {};try {c=require(configFile)} finally {return c}}(),
|
||||
|
||||
read:function(key){
|
||||
var x = this.persistent[key] || this[key]
|
||||
|
|
@ -39,7 +42,7 @@ module.exports = function(fs) {
|
|||
},
|
||||
write:function(key,value) {
|
||||
this.persistent[key] = value
|
||||
fs.writeFile(__dirname + '/config.json',JSON.stringify(this.persistent,null,4), function (err, data) {
|
||||
fs.writeFile(configFile,JSON.stringify(this.persistent,null,4), function (err, data) {
|
||||
if (err) throw err
|
||||
})
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue