mirror of
https://github.com/vlang/v.git
synced 2023-08-10 21:13:21 +03:00
os: make os.ls('') return an error, make os.walk_ext more memory efficient on deep hierarchies, add tests for os.walk_ext
This commit is contained in:
@@ -254,6 +254,9 @@ fn init_os_args(argc int, argv &&byte) []string {
|
||||
}
|
||||
|
||||
pub fn ls(path string) ?[]string {
|
||||
if path.len == 0 {
|
||||
return error('ls() expects a folder, not an empty string')
|
||||
}
|
||||
mut res := []string{}
|
||||
dir := unsafe { C.opendir(&char(path.str)) }
|
||||
if isnil(dir) {
|
||||
|
Reference in New Issue
Block a user