Skip to content

Commit

Permalink
core.get_dir_list, move common/fs to root
Browse files Browse the repository at this point in the history
  • Loading branch information
S-S-X committed Jan 5, 2025
1 parent b6c1ad1 commit ba969df
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 6 deletions.
5 changes: 0 additions & 5 deletions common/fs.lua

This file was deleted.

2 changes: 1 addition & 1 deletion core.lua
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ mineunit("common/misc_helpers")
mineunit("game/privileges")
mineunit("game/features")
mineunit("common/serialize")
mineunit("common/fs")
mineunit("fs")

assert(minetest.registered_nodes["air"])
assert(minetest.registered_nodes["ignore"])
Expand Down
17 changes: 17 additions & 0 deletions fs.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
local pl = {
dir = require 'pl.dir',
path = require 'pl.path',
}

core.mkdir = function()
-- no-op
-- TODO: create directory and implement io.* functions
end

core.get_dir_list = function(path, list_dirs)
local results = {}
for _,name in ipairs(list_dirs and pl.dir.getdirectories(path) or pl.dir.getfiles(path)) do
table.insert(results, pl.path.basename(name))
end
return results
end

0 comments on commit ba969df

Please sign in to comment.