| 178 | }).catch((t) => this.logErr(t)); |
| 179 | } |
| 180 | loaddata() { |
| 181 | if (!this.isNode()) return {}; |
| 182 | { |
| 183 | this.fs = this.fs ? this.fs : require("fs"); |
| 184 | this.path = this.path ? this.path : require("path"); |
| 185 | const t = this.path.resolve(this.dataFile), |
| 186 | s = this.path.resolve(process.cwd(), this.dataFile), |
| 187 | e = this.fs.existsSync(t), |
| 188 | i = !e && this.fs.existsSync(s); |
| 189 | if (!e && !i) return {}; |
| 190 | { |
| 191 | const i = e ? t : s; |
| 192 | try { |
| 193 | return JSON.parse(this.fs.readFileSync(i)); |
| 194 | } catch (t) { |
| 195 | return {}; |
| 196 | } |
| 197 | } |
| 198 | } |
| 199 | } |
| 200 | writedata() { |
| 201 | if (this.isNode()) { |
| 202 | this.fs = this.fs ? this.fs : require("fs"); |