"use strict";(function(){var e=0;var t=0;"use strict";var r=require("path");var n=require("fs");var i=require("./jsUtil");var o=".conf";var f="config";function a(){var e=this;e.filePath=null;e.confObject=null}function c(e){var t=s();var n=r.resolve(i.getDataPath(),"config");var o=r.resolve(n,t);i.ensurePathFile(n,o);e.filePath=o}function u(e){var t;c(e);try{t=JSON.parse(n.readFileSync(e.filePath,"utf-8"))}catch(r){return{}}return t}function l(e){try{n.writeFileSync(e.filePath,JSON.stringify(e.confObject))}catch(t){return false}return true}function s(){var e=i.getPkgInfo();if(!e||!e.name){return f+o}return e.name+o}a.prototype.writeConfig=function(e,t){var r=this;if(!e||t===undefined||t===null||t===""){return false}if(!r.confObject){r.confObject=u(r)}r.confObject[e]=t;if(!l(r)){delete r.confObject[e];return false}return true};a.prototype.getFilePath=function(){if(!this.filePath)c(this);return this.filePath};a.prototype.readConfig=function(e){var t=this;if(!e){return undefined}if(!t.confObject){t.confObject=u(t)}var r=t.confObject[e];return r};module.exports=a;if(t){var g=new a;g.writeConfig("a",true);g.writeConfig("b",false);g.writeConfig("c",{});g.writeConfig("d",1);console.log(g.readConfig("a"));console.log(g.readConfig("b"));console.log(g.readConfig("c"));console.log(g.readConfig("d"));console.log(g.readConfig("e"))}})();