初始化提交

This commit is contained in:
王立帮
2024-07-19 10:16:00 +08:00
parent 4c7b571f20
commit 4a2d56dcc4
7084 changed files with 741212 additions and 63 deletions

View File

@@ -0,0 +1,47 @@
goog.loadJs('web', () => {
goog.require('path');
goog.require('Mixly.FileTree');
goog.require('Mixly.Web.FS');
goog.provide('Mixly.Web.FileTree');
const { FileTree, Web } = Mixly;
const { FS } = Web;
class FileTreeExt extends FileTree {
constructor(element, mprogress) {
super(element, mprogress, FS);
}
async readFolder(inPath) {
const fs = this.getFS();
const status = await fs.isDirectory(inPath);
let output = [];
if (!status) {
return output;
}
const children = await fs.readDirectory(inPath);
for (let data of children) {
const dataPath = path.join(inPath, data);
if (await fs.isDirectory(dataPath)) {
const isDirEmpty = await fs.isDirectoryEmpty(dataPath);
output.push({
type: 'folder',
id: dataPath,
children: !isDirEmpty
});
} else {
output.push({
type: 'file',
id: dataPath,
children: false
});
}
}
return output;
}
}
Web.FileTree = FileTreeExt;
});