🐛 fix unix.isdir & unix.isfile

This commit is contained in:
ValKmjolnir
2022-06-03 21:53:14 +08:00
parent c3a8e118f5
commit 4e6cd82ccb
2 changed files with 14 additions and 14 deletions
+2 -2
View File
@@ -410,8 +410,8 @@ var unix=
dup2: func(fd0,fd1){die("not supported yet");},
exec: func(filename,argv,envp){die("not supported yet");},
waitpid: func(pid,nohang=0){return __builtin_waitpid;},
isdir: func(path){return bits.u32_and(io.stat(path)[2],0x4000);}, # S_IFDIR 0x4000
isfile: func(path){return bits.u32_and(io.stat(path)[2],0x8000);}, # S_IFREG 0x8000
isdir: func(path){return !!bits.u32_and(io.stat(path)[2],0x4000);}, # S_IFDIR 0x4000
isfile: func(path){return !!bits.u32_and(io.stat(path)[2],0x8000);}, # S_IFREG 0x8000
opendir: func(path){return __builtin_opendir;},
readdir: func(handle){return __builtin_readdir;},
closedir: func(handle){return __builtin_closedir;},