This commit is contained in:
libccy 2017-02-14 13:25:29 +08:00
parent 41ee4e4773
commit 9ecb30c56f
1 changed files with 14 additions and 44 deletions

View File

@ -17942,48 +17942,18 @@
} }
} }
if(lib.node&&lib.node.fs){ if(lib.node&&lib.node.fs){
var access=function(){ game.ensureDirectory('extension/'+extname,function(){
var dirname=__dirname+'/extension/'+extname; var writeFile=function(){
var finish=function(){ if(filelist.length){
dirname+='/'; var filename=filelist.shift();
var writeFile=function(){ lib.node.fs.writeFile(__dirname+'/extension/'+extname+'/'+filename,zip.files[filename].asNodeBuffer(),null,writeFile);
if(filelist.length){ }
var filename=filelist.shift(); else{
lib.node.fs.writeFile(dirname+filename,zip.files[filename].asNodeBuffer(),null,writeFile); finishLoad();
} }
else{ }
finishLoad(); writeFile();
} });
}
writeFile();
};
lib.node.fs.access(dirname,function(e){
if(e){
try{
lib.node.fs.mkdir(dirname,finish);
}
catch(e){
throw('err');
}
}
else{
finish();
}
});
};
lib.node.fs.access(__dirname+'/extension',function(e){
if(e){
try{
lib.node.fs.mkdir(__dirname+'/extension',access);
}
catch(e){
throw('err');
}
}
else{
access();
}
});
} }
else{ else{
window.resolveLocalFileSystemURL(lib.assetURL,function(entry){ window.resolveLocalFileSystemURL(lib.assetURL,function(entry){
@ -27597,7 +27567,7 @@
ui.create.div('','<input type="file" accept="application/zip" style="width:153px"><button>确定</button>',importExtension); ui.create.div('','<input type="file" accept="application/zip" style="width:153px"><button>确定</button>',importExtension);
if(!game.download){ if(!game.download||true){
extensionnode.classList.add('on'); extensionnode.classList.add('on');
importExtension.style.display=''; importExtension.style.display='';
importextensionexpanded=true; importextensionexpanded=true;
@ -27744,7 +27714,7 @@
}; };
node.update=function(){ node.update=function(){
if(!game.download||this.updated) return; if(!game.download||this.updated||true) return;
if(!window.JSZip){ if(!window.JSZip){
lib.init.js(lib.assetURL+'game','jszip'); lib.init.js(lib.assetURL+'game','jszip');
} }