feat: sync mixly root files and common folder

This commit is contained in:
yczpf2019
2026-01-24 16:12:04 +08:00
parent 93e17c00ae
commit c8c5fcf726
2920 changed files with 186461 additions and 0 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() {
super(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;
});