From 3d1e602337ef395575a8e306d5667f8c5fc449ff Mon Sep 17 00:00:00 2001 From: Kokomi <1379177109@qq.com> Date: Tue, 21 May 2024 03:32:54 +0800 Subject: [PATCH] =?UTF-8?q?Revert=20"=E6=9B=B4=E6=96=B0=E9=83=A8=E5=88=86?= =?UTF-8?q?=E6=96=87=E4=BB=B6=E5=BC=95=E7=94=A8=E7=9A=84=E6=96=B9=E5=BC=8F?= =?UTF-8?q?=EF=BC=8C=E9=99=8D=E4=BD=8E=E5=AF=B9process=E8=B7=AF=E5=BE=84?= =?UTF-8?q?=E7=9A=84=E4=BE=9D=E8=B5=96"?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This reverts commit 1da5d9a6d1f3424de877335c39e9b343dcf755ea. --- components/Cfg.js | 3 +-- components/Data.js | 3 +-- models/ProfileDmg.js | 5 ++--- models/character/CharCfg.js | 2 +- models/index.js | 4 ++-- 5 files changed, 7 insertions(+), 10 deletions(-) diff --git a/components/Cfg.js b/components/Cfg.js index d71d7f1a..eabce460 100644 --- a/components/Cfg.js +++ b/components/Cfg.js @@ -3,8 +3,7 @@ import lodash from 'lodash' import cfgData from './cfg/CfgData.js' import { Version } from '#miao' -//const _path = process.cwd() -const _path = import.meta.dirname + '/../../../' +const _path = process.cwd() const _cfgPath = `${_path}/plugins/miao-plugin/components/` let cfg = {} let miaoCfg = {} diff --git a/components/Data.js b/components/Data.js index 44e4d576..849e4ae7 100644 --- a/components/Data.js +++ b/components/Data.js @@ -2,8 +2,7 @@ import lodash from 'lodash' import fs from 'node:fs' import util from 'node:util' -//const _path = process.cwd() -const _path = import.meta.dirname + '/../../../' +const _path = process.cwd() const getRoot = (root = '') => { if (!root) { root = `${_path}/` diff --git a/models/ProfileDmg.js b/models/ProfileDmg.js index f06bde91..70002197 100644 --- a/models/ProfileDmg.js +++ b/models/ProfileDmg.js @@ -20,15 +20,14 @@ export default class ProfileDmg extends Base { } static dmgRulePath (name, game = 'gs') { - //const _path = process.cwd() - const _path = import.meta.dirname + '/../' + const _path = process.cwd() let dmgFile = [ { file: 'calc_user', name: '自定义伤害' }, { file: 'calc_auto', name: '组团伤害', test: () => Common.cfg('teamCalc') }, { file: 'calc', name: '喵喵' } ] for (let ds of dmgFile) { - let path = `${_path}/resources/meta-${game}/character/${name}/${ds.file}.js` + let path = `${_path}/plugins/miao-plugin/resources/meta-${game}/character/${name}/${ds.file}.js` if (ds.test && !ds.test()) { continue } diff --git a/models/character/CharCfg.js b/models/character/CharCfg.js index aaa75723..95a56f9b 100644 --- a/models/character/CharCfg.js +++ b/models/character/CharCfg.js @@ -2,7 +2,7 @@ import { Data } from '#miao' import lodash from 'lodash' import fs from 'node:fs' -const charPath = import.meta.dirname + '../../../resources/meta-gs/character' +const charPath = process.cwd() + '/plugins/miao-plugin/resources/meta-gs/character' let cfgMap = { char: {}, async init () { diff --git a/models/index.js b/models/index.js index 7b9c3221..e86305ea 100644 --- a/models/index.js +++ b/models/index.js @@ -17,10 +17,10 @@ import Button from './Button.js' for (let game of ['gs', 'sr']) { for (let type of ['artifact', 'character', 'material', 'weapon']) { - let file = `${import.meta.dirname}/../resources/meta-${game}/${type}/index.js` + let file = `./plugins/miao-plugin/resources/meta-${game}/${type}/index.js` if (fs.existsSync(file)) { try { - await import(`file://${file}`) + await import(`file://${process.cwd()}/${file}`) } catch (e) { console.log(e) }