Adds folder creation

This commit is contained in:
AliasAlreadyTaken 2024-04-07 23:15:32 +02:00
parent d5d79befad
commit 6820436b90
2 changed files with 15 additions and 14 deletions

View File

@ -23,11 +23,11 @@ yl_scheduler.information.additional = "Execute tasks based on utc"
dofile(yl_scheduler.modpath .. "config.lua")
dofile(yl_scheduler.modpath .. "setup.lua")
dofile(yl_scheduler.modpath .. "privs.lua")
dofile(yl_scheduler.modpath .. "internal.lua")
dofile(yl_scheduler.modpath .. "api.lua")
dofile(yl_scheduler.modpath .. "globalsteps.lua")
dofile(yl_scheduler.modpath .. "chatcommands.lua")
--dofile(yl_scheduler.modpath .. "privs.lua")
--dofile(yl_scheduler.modpath .. "internal.lua")
--dofile(yl_scheduler.modpath .. "api.lua")
--dofile(yl_scheduler.modpath .. "globalsteps.lua")
--dofile(yl_scheduler.modpath .. "chatcommands.lua")
local mod_end_time = (core.get_us_time() - mod_start_time) / 1000000
core.log("action", "[MOD] yl_scheduler loaded in [" .. mod_end_time .. "s]")

View File

@ -1,16 +1,17 @@
local mkdir = minetest.mkdir
local save_path = yl_scheduler.settings.save_path
local function run_once()
local dl = minetest.get_dir_list(yl_template.worldpath, true)
local create = true
for _, v in ipairs(dl) do
if v == yl_template.settings.save_path then
create = false
end
local path = yl_scheduler.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_template.worldpath .. DIR_DELIM .. yl_template.settings.save_path)
end
end
run_once()