--- a/src/server/test/vfs.c Sun May 31 17:31:43 2020 +0200 +++ b/src/server/test/vfs.c Sun May 31 19:35:29 2020 +0200 @@ -81,7 +81,14 @@ TestVFSFile *file = NULL; UCX_MAP_FOREACH(key, file, vfsdir->i) { - if(sstrprefix(file->path, prefix)) { + sstr_t file_path = sstrcat( + 2, + prefix, + sstr(test_resource_name(file->path.ptr))); + void *m = ucx_map_get(vfs->files, ucx_key(file_path.ptr, file_path.length)); + // don't ask why alfree and not free() + alfree(ucx_default_allocator(), file_path.ptr); + if(m) { break; } else { file = NULL; @@ -95,6 +102,14 @@ sstr(test_resource_name(file->path.ptr))); ZERO(entry, sizeof(VFS_ENTRY)); entry->name = vfsdir->name.ptr; + + if(getstat) { + ZERO(&entry->stat, sizeof(struct stat)); + if(file->isdir) { + entry->stat.st_mode = S_IFDIR; + } + } + return 1; } else { return 0; @@ -151,6 +166,12 @@ if(!file) { return 1; } + + ZERO(buf, sizeof(struct stat)); + if(file->isdir) { + buf->st_mode = S_IFDIR; + } + return 0; }