import fsys;
import math;
var pidMap = {};
math.randomize();
fsys.enum( "~lib", "*.*",
function(dir,filename,fullpath){
var id = "id" + "" + string.sub(string.concat(tonumber(time()),string.random(3,"0123456789")),4);
var kind,name,pid,parentpath;
pid = 0;
parentpath = fsys.getParentDir(fullpath);
if(pidMap[parentpath]){
pid = pidMap[parentpath];
}
if(filename){
name = filename;
kind = "file";
}
else{
name = dir;
kind = "dir";
var tmpfullpath = fullpath + "";
pidMap[tmpfullpath] = id;
}
import console
console.dump({
fid = id;
fname = name;
fkind = kind;
fpid = pid;
})
}
);
import win
win.loopMessage()
https://blog.csdn.net/aifuqiang635104032/article/details/48689575