From 9bcedbc919b250235d8ac2c059a407bf285a294f Mon Sep 17 00:00:00 2001 From: Rintim Date: Sun, 3 Sep 2023 18:06:04 +0800 Subject: [PATCH] modify game.getFileList. --- game/game.js | 51 +++++++++++++++++++++++++++++++++------------------ 1 file changed, 33 insertions(+), 18 deletions(-) diff --git a/game/game.js b/game/game.js index ab642343a..fbdf0a801 100644 --- a/game/game.js +++ b/game/game.js @@ -8389,13 +8389,13 @@ }); }); }; - game.getFileList=function(dir,callback){ + game.getFileList=(dir,success,failure)=>{ var files=[],folders=[]; - window.resolveLocalFileSystemURL(lib.assetURL+dir,function(entry){ + window.resolveLocalFileSystemURL(lib.assetURL+dir,entry=>{ var dirReader=entry.createReader(); var entries=[]; - var readEntries=function(){ - dirReader.readEntries(function(results){ + var readEntries=()=>{ + dirReader.readEntries(results=>{ if(!results.length){ entries.sort(); for(var i=0;i{ var files=[],folders=[]; dir=__dirname+'/'+dir; - lib.node.fs.readdir(dir,function(err,filelist){ - for(var i=0;i{ + if(err) { + failure(err); + return; + } + lib.node.fs.readdir(dir,(err,filelist)=>{ + if(err){ + failure(err); + return; + } + for(var i=0;i