mirror of
https://github.com/MihailRis/voxelcore.git
synced 2026-10-06 19:41:51 +00:00
add io::directory_iterator
This commit is contained in:
parent
c3066eebd3
commit
347d76870a
13 changed files with 182 additions and 64 deletions
|
|
@ -95,7 +95,8 @@ static int l_exists(lua::State* L) {
|
|||
}
|
||||
|
||||
static int l_isfile(lua::State* L) {
|
||||
io::path path = resolve_path_soft(lua::require_string(L, 1));
|
||||
const char* string =lua::require_string(L, 1);
|
||||
io::path path = resolve_path_soft(string);
|
||||
return lua::pushboolean(L, io::is_regular_file(path));
|
||||
}
|
||||
|
||||
|
|
@ -184,10 +185,8 @@ static int l_list(lua::State* L) {
|
|||
}
|
||||
lua::createtable(L, 0, 0);
|
||||
size_t index = 1;
|
||||
for (auto& entry : fs::directory_iterator(io::resolve(path))) {
|
||||
auto name = entry.path().filename().u8string();
|
||||
auto file = dirname + "/" + name;
|
||||
lua::pushstring(L, file);
|
||||
for (const auto& file : io::directory_iterator(path)) {
|
||||
lua::pushstring(L, file.string());
|
||||
lua::rawseti(L, index);
|
||||
index++;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue