Config.ts 690 B

12345678910111213141516171819202122
  1. const App = CS.FairyEditor.App;
  2. const cfgPath = `${App.pluginManager.basePath}/xgame-ext/Config.json`;
  3. export default class Config {
  4. /**psd2fgui的插件路径,该插件依赖的npm库比较大,单独保存*/
  5. public psd2fguiPluginsPath: string;
  6. /**依赖信息清单路径*/
  7. public dependencyManifestPath: string;
  8. public wirte() {
  9. let config = JSON.stringify(this)
  10. CS.System.IO.File.WriteAllText(cfgPath, config)
  11. }
  12. static load(): Config {
  13. if (CS.System.IO.File.Exists(cfgPath) == false) {
  14. return null;
  15. }
  16. let text = CS.System.IO.File.ReadAllText(cfgPath)
  17. return JSON.parse(text) as Config
  18. }
  19. }