🚀 optimize code

This commit is contained in:
ValKmjolnir
2022-08-08 22:10:51 +08:00
parent eff98fa9b4
commit e51ba92f30
4 changed files with 7 additions and 5 deletions
+4
View File
@@ -5,6 +5,8 @@ var file={
SEEK_CUR:io.SEEK_CUR,
SEEK_END:io.SEEK_END,
new: func(filename,mode="r"){
if(!io.exists(filename))
return nil;
var fd=io.open(filename,mode);
return {
close: func(){io.close(fd);},
@@ -24,6 +26,8 @@ var file={
};
var find_all_files=func(path){
if(!io.exists(path))
return [];
var dd=unix.opendir(path);
var res=[];
while(var n=unix.readdir(dd))