import fs = require('fs'); import os = require('os'); import path = require('path'); export class Paths { //插件根目录 static PATH_BASE_PLUGINS: string = path.normalize(process.cwd() + "/src/plugins/"); //文档基础路径 static PATH_BASE_DOC: string = path.normalize(process.cwd() + "/doc/"); //插件输出类 static PATH_BASE_OUTPUT_PLUGINS: string = path.normalize(process.cwd() + "/lib/plugins/"); /** els库路径 */ static PATH_ELSLIB: string = path.normalize(process.cwd() + "/els/bin/els/els.d.ts"); //获取工具基础路径 static get basePath(): string { return process.cwd(); } static get projectIndexPath(): string{ return path.normalize(Paths.exampleDirectory + '/runtime/index.html'); } static get exampleDirectory(): string{ return this.PATH_BASE_DOC+'examples/game'; } static get projectDirectory(): string{ return this.exampleDirectory + '/runtime/resource'; } static get documentsDirectory(): string{ return path.normalize(os.homedir() + "/Documents"); } static get desktopDirectory(): string{ return path.normalize(os.homedir() + "/Desktop"); } static get applicationDirectory(): string{ return __dirname; } //根据场景名获取场景路径 static getSceneDirectory(sceneName: string): string{ return path.normalize(this.exampleDirectory + '/runtime/resource/scene/' + sceneName + ".els"); } /** 根据名字获取组件地址 */ static getComponentUrlByName(componentName: string): string{ return path.normalize(this.exampleDirectory+'/runtime/src/plugins/' + componentName + ".ts"); } /** 根据名字获取组件输出地址 */ static getComponentOutputUrlByName(componentName: string): string{ return path.normalize(this.exampleDirectory+'/runtime/bin-debug/plugins/' + componentName + ".js"); } //TODO static get applicationStorageDirectory(): string{ return os.homedir(); } //TODO static get cacheDirectory(): string{ return os.homedir(); } //TODO static get userDirectory(): string{ return os.homedir(); } }