1 parent 9b40176 commit 25077ecCopy full SHA for 25077ec
1 file changed
utils/misc/nodejs-terminal/html/webcontainer-fs/webcontainer-fs.html
@@ -150,28 +150,15 @@
150
var files = [];
151
152
153
- console.log(await webcontainer.fs.readdir('/'));
+ var list = await webcontainer.fs.readdir(path,{withFileTypes:true})
154
155
+ list.forEach(item=>{
156
- return;
157
-
158
159
- var {names:list} = await db.list(prefix+path,true);
160
- list.forEach(abs=>{
161
162
- var i = abs.indexOf('/',len);
163
- //console.log(abs,i);
164
- var fn;
165
- if(i==-1){
166
- fn = abs.slice(len);
167
- if(fn){
168
- files.push(fn);
169
- }
170
- }else{
171
- fn = abs.slice(len,i);
172
- if(dirs.indexOf(fn)==-1){
173
- dirs.push(fn);
174
+ if(item.isFile()){
+ files.push(item.name);
+ }
+ if(item.isDirectory()){
+ dirs.push(item.name);
175
}
176
177
});
0 commit comments