| 122 | }).catch(t => this.logErr(t)) |
| 123 | } |
| 124 | loaddata() { |
| 125 | if (!this.isNode()) return {} |
| 126 | { |
| 127 | ;(this.fs = this.fs ? this.fs : require('fs')), (this.path = this.path ? this.path : require('path')) |
| 128 | const t = this.path.resolve(this.dataFile), |
| 129 | e = this.path.resolve(process.cwd(), this.dataFile), |
| 130 | s = this.fs.existsSync(t), |
| 131 | a = !s && this.fs.existsSync(e) |
| 132 | if (!s && !a) return {} |
| 133 | { |
| 134 | const a = s ? t : e |
| 135 | try { |
| 136 | return JSON.parse(this.fs.readFileSync(a)) |
| 137 | } catch (t) { |
| 138 | return {} |
| 139 | } |
| 140 | } |
| 141 | } |
| 142 | } |
| 143 | writedata() { |
| 144 | if (this.isNode()) { |
| 145 | ;(this.fs = this.fs ? this.fs : require('fs')), (this.path = this.path ? this.path : require('path')) |