You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
51 lines
1.7 KiB
51 lines
1.7 KiB
import FileManager from "../FileTools/FileManager";
|
|
|
|
|
|
export default class EditorTools{
|
|
static getDirAlllist(path: string,match:string|string[],noMatch:string = '.meta') {
|
|
let fileos = FileManager.ins().mFileTools.EnditorFSOrOs;
|
|
let csvlist = fileos.readdirSync(path);
|
|
let list: string[] = [];
|
|
for (let i = 0; i < csvlist.length; i++) {
|
|
const csvPath = csvlist[i];
|
|
let csvAllPaht = `${path}/${csvPath}`;
|
|
if (!csvPath.includes(".")) {
|
|
list = list.concat(this.getDirAlllist(csvAllPaht,match));
|
|
continue;
|
|
} else {
|
|
if (!csvPath.includes(noMatch)) {
|
|
if (Array.isArray(match)) {
|
|
{
|
|
for (let k = 0; k < match.length; k++) {
|
|
if (csvPath.includes(match[k])) {
|
|
list.push(csvAllPaht);
|
|
break;
|
|
}
|
|
}
|
|
}
|
|
} else {
|
|
if (csvPath.includes(match)) {
|
|
list.push(csvAllPaht);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
return list;
|
|
}
|
|
|
|
static async getBundleName(path:string,dir:string[]){
|
|
let findPath = path;
|
|
for (let i = 0; i < dir.length; i++) {
|
|
if(dir[i].length<1){continue;}
|
|
findPath += dir[i];
|
|
let data = await Editor.Message.request('asset-db', 'query-asset-meta', findPath);
|
|
if(data?.userData?.isBundle){
|
|
return dir[i]
|
|
}
|
|
findPath+="/";
|
|
}
|
|
return "";
|
|
|
|
}
|
|
}
|