ZZZ-Plugin/lib/path.js
2024-07-08 13:13:22 +08:00

29 lines
726 B
JavaScript

import path from 'path';
import { fileURLToPath } from 'url';
// 获取当前模块的 URL
const metaUrl = import.meta.url;
// 将 URL 转换为文件路径
const metaPath = fileURLToPath(new URL(metaUrl));
// 插件路径
export const pluginPath = path.join(metaPath, '../../');
// 插件名
export const pluginName = path.basename(pluginPath);
// apps 路径
export const appPath = path.join(pluginPath, 'apps');
// resources
export const resourcesPath = path.join(pluginPath, 'resources');
// config 路径
export const configPath = path.join(pluginPath, 'config');
// 默认配置路径
export const defPath = path.join(pluginPath, 'defSet');
// data 路径
export const dataPath = path.join(pluginPath, 'data');