forked from your-land/yl_cinema
Onetime Setup
This commit is contained in:
parent
7113312e43
commit
dde04d113b
17
setup.lua
17
setup.lua
@ -1,19 +1,18 @@
|
||||
|
||||
local mkdir = minetest.mkdir
|
||||
local save_path = yl_cinema.settings.save_path
|
||||
|
||||
local function run_once()
|
||||
local dl = minetest.get_dir_list(yl_cinema.worldpath, true)
|
||||
local create = true
|
||||
|
||||
for _, v in ipairs(dl) do
|
||||
if v == save_path then
|
||||
create = false
|
||||
end
|
||||
local path = yl_cinema.worldpath .. DIR_DELIM .. save_path
|
||||
|
||||
local file = io.open(path, "r")
|
||||
if not file then
|
||||
mkdir(path)
|
||||
else
|
||||
file:close()
|
||||
end
|
||||
|
||||
if create then
|
||||
minetest.mkdir(yl_cinema.worldpath .. DIR_DELIM .. save_path)
|
||||
end
|
||||
end
|
||||
|
||||
run_once()
|
||||
|
Loading…
Reference in New Issue
Block a user