2019-12-26 18:19:48 +08:00
|
|
|
let fs = require("fs")
|
|
|
|
let getreptilelist =(dirlist)=>{
|
2020-01-02 10:24:33 +08:00
|
|
|
return new Promise((res,err)=>{
|
|
|
|
let reptilelist = [];
|
|
|
|
// console.log(dirlist)
|
2019-12-26 18:19:48 +08:00
|
|
|
for(let i in dirlist){
|
|
|
|
let reptile = require(__dirname + "/" + dirlist[i] +"/config.js" )
|
2020-01-02 10:24:33 +08:00
|
|
|
// console.log(reptile)
|
2019-12-26 18:19:48 +08:00
|
|
|
reptilelist.push(reptile)
|
|
|
|
}
|
2020-01-02 10:24:33 +08:00
|
|
|
res(reptilelist)
|
2019-12-26 18:19:48 +08:00
|
|
|
})
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
getlist =()=>{
|
2020-01-02 10:24:33 +08:00
|
|
|
return new Promise((r,e)=>{
|
2019-12-26 18:19:48 +08:00
|
|
|
fs.readdir(__dirname, (err, res) => {
|
|
|
|
for (let i in res) {
|
|
|
|
if (res[i] == "binimport.js") {
|
|
|
|
res.splice(i, 1)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
dirlist = res
|
|
|
|
// console.log(res)
|
|
|
|
getreptilelist(dirlist).then((s)=>{
|
|
|
|
r(s)
|
|
|
|
})
|
|
|
|
})
|
|
|
|
})
|
|
|
|
}
|
|
|
|
|
2020-01-02 10:24:33 +08:00
|
|
|
module.exports = getlist
|
2019-12-26 18:19:48 +08:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|