From 3a3d3cd5217b31b23eb6774e74950367a3f9c4a5 Mon Sep 17 00:00:00 2001 From: Rintim Date: Mon, 22 Apr 2024 20:58:31 +0800 Subject: [PATCH] feat: add game.promises.getFileList. --- noname/game/promises.js | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/noname/game/promises.js b/noname/game/promises.js index a79a407d3..a8c3943d9 100644 --- a/noname/game/promises.js +++ b/noname/game/promises.js @@ -126,4 +126,17 @@ export class GamePromises { }) ); } + + /** + * 获取文件列表 + * + * @param { string } dir 目录 + * @returns { Promise<[string[], string[]]> } 返回一个数组,第一个元素是文件夹列表,第二个元素是文件列表 + */ + getFileList(dir) { + return new Promise((resolve, reject) => { + // @ts-ignore + game.getFileList(dir, (folders, files) => resolve([folders, files]), reject); + }); + } }