generic types, any -> opaque
This commit is contained in:
@@ -117,19 +117,19 @@ func os.is_a_directory[path: str] : bool
|
||||
|
||||
return (mem.read32(st + 24) & S_IFMT) == S_IFDIR
|
||||
|
||||
func os.list_directory[path: str] : Array, bool
|
||||
func os.list_directory[path: str] : Array<str>, bool
|
||||
fd := _builtin_syscall(SYS_openat, AT_FDCWD, path, O_RDONLY, 0)
|
||||
if fd < 0
|
||||
return 0 as Array, false
|
||||
return 0 as Array<str>, false
|
||||
|
||||
files := []
|
||||
files := [] as Array<str>
|
||||
buf := _stackalloc(1024)
|
||||
while true
|
||||
n := _builtin_syscall(SYS_getdents64, fd, buf, 1024)
|
||||
if n < 0
|
||||
files->free_with_items()
|
||||
_builtin_syscall(SYS_close, fd)
|
||||
return 0 as Array, false
|
||||
return 0 as Array<str>, false
|
||||
else if n == 0
|
||||
break
|
||||
|
||||
|
||||
Reference in New Issue
Block a user