From ed225322a5a844eca5ee673e468ddc4df3ed3f68 Mon Sep 17 00:00:00 2001 From: Jerry Date: Fri, 25 Apr 2025 23:09:28 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8Dpath=E6=96=87=E4=BB=B6?= =?UTF-8?q?=E8=A2=ABide=E5=90=83=E6=8E=89=E7=9A=84=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- constants/path.js | 26 ++++++++++++++++++++++++++ constants/relativelyPath.js | 5 +++++ 2 files changed, 31 insertions(+) create mode 100644 constants/path.js create mode 100644 constants/relativelyPath.js diff --git a/constants/path.js b/constants/path.js new file mode 100644 index 0000000..2ac80bb --- /dev/null +++ b/constants/path.js @@ -0,0 +1,26 @@ +import path from 'path'; +import url from 'url'; +import fs from 'fs'; + +const __filename = url.fileURLToPath(import.meta.url); +const __dirname = path.dirname(__filename); +const rootDir = path.join(__dirname, '..'); + +const Path = { + root: rootDir, + apps: path.join(rootDir, 'apps'), + components: path.join(rootDir, 'components'), + defaultConfig: path.join(rootDir, 'config/default.json'), + config: path.resolve(rootDir, '../../data/crystelf'), + constants: path.join(rootDir, 'constants'), + lib: path.join(rootDir, 'lib'), + models: path.join(rootDir, 'models'), + index: path.join(rootDir, 'index.js'), + pkg: path.join(rootDir, 'package.json'), + yunzai: path.join(rootDir, '../../'), +}; + +const configFile = fs.readFileSync(Path.defaultConfig, 'utf8'); +export const defaultConfig = JSON.parse(configFile); + +export default Path; diff --git a/constants/relativelyPath.js b/constants/relativelyPath.js new file mode 100644 index 0000000..19564c5 --- /dev/null +++ b/constants/relativelyPath.js @@ -0,0 +1,5 @@ +const relativelyPath = { + config: '/data/crystelf/config.json', +}; + +export default relativelyPath;