From d07a7e867b7926005fee9d3e0b0676b4a5d15e57 Mon Sep 17 00:00:00 2001 From: smallfawn <860562056@QQ.COM> Date: Tue, 7 Apr 2026 14:12:27 +0800 Subject: [PATCH] fix bug --- Tools/env.js | 12 +++++++++++- tools/env.js | 12 +++++++++++- 2 files changed, 22 insertions(+), 2 deletions(-) diff --git a/Tools/env.js b/Tools/env.js index a2bb4f6..141b91c 100644 --- a/Tools/env.js +++ b/Tools/env.js @@ -11,8 +11,18 @@ function Env(t, s) { this.startTime = new Date().getTime(); Object.assign(this, s); this.log(`\ud83d\udd14${this.name},\u5f00\u59cb!`); - this.bucket = '' + this.bucket = this.bucket || '' this.fs = require("fs"); + if (this.isNode() && this.bucket) { + try { + if (!this.fs.existsSync(this.bucket)) { + this.fs.writeFileSync(this.bucket, JSON.stringify({}, null, 2)); + this.log(`📁 已创建 bucket 文件: ${this.bucket}`); + } + } catch (e) { + this.log("❌ 初始化 bucket 失败: " + e.message); + } + } } async get(key, def = null) { if (!this.isNode()) return def; diff --git a/tools/env.js b/tools/env.js index a2bb4f6..141b91c 100644 --- a/tools/env.js +++ b/tools/env.js @@ -11,8 +11,18 @@ function Env(t, s) { this.startTime = new Date().getTime(); Object.assign(this, s); this.log(`\ud83d\udd14${this.name},\u5f00\u59cb!`); - this.bucket = '' + this.bucket = this.bucket || '' this.fs = require("fs"); + if (this.isNode() && this.bucket) { + try { + if (!this.fs.existsSync(this.bucket)) { + this.fs.writeFileSync(this.bucket, JSON.stringify({}, null, 2)); + this.log(`📁 已创建 bucket 文件: ${this.bucket}`); + } + } catch (e) { + this.log("❌ 初始化 bucket 失败: " + e.message); + } + } } async get(key, def = null) { if (!this.isNode()) return def;