12345678910111213141516171819202122 |
- const Fs=require("fire-fs"),Path=require("fire-path");
- module.exports={
- load(){},
- unload(){},
- messages:{
- showPanel(){
- Editor.Panel.open("hot-update-tools")
- },
- "editor:build-finished":(o,t)=>{
- if(Editor.log("[HotUpdateTools] build platform:"+t.platform),"win32"===t.platform||"android"===t.platform||"ios"===t.platform||"mac"===t.platform){
- let o=Editor.url("packages://hot-update-tools/main_code.js");
- if(Fs.existsSync(o)){
- const e=Fs.readFileSync(o,"utf-8");
- let a=Path.normalize(t.dest),i=Path.join(a,"main.js"),l=e+Fs.readFileSync(i,"utf8");
- Fs.writeFileSync(i,l),Editor.log("[HotUpdateTools] SearchPath updated in built main.js for hot update");
- let d=(new Date).getTime();
- Editor.Ipc.sendToPanel("hot-update-tools","hot-update-tools:onBuildFinished",d),Editor.require("packages://hot-update-tools/core/CfgUtil.js").updateBuildTimeByMain(d)
- }else Editor.log(`文件丢失: ${o}`)
- }else Editor.log(`[HotUpdateTools] don't need update main.js, platform: ${t.platform}`)
- }
- }
- };
|