Use minetest.mkdir when available

This commit is contained in:
ShadowNinja 2015-05-16 19:56:45 -04:00
parent c5954e4f07
commit 8ce345aaa8

@ -15,12 +15,16 @@ function datastorage.save(id)
if not file then if not file then
-- Most likely the data directory doesn't exist, create it -- Most likely the data directory doesn't exist, create it
-- and try again. -- and try again.
-- Using os.execute like this is not very platform independent if minetest.mkdir then
-- or safe; but most platforms name their directory minetest.mkdir(data_path)
-- creation utility mkdir, and the data path is unlikely to else
-- contain special characters and is only mutabable by the -- Using os.execute like this is not very platform
-- admin. -- independent or safe, but most platforms name their
os.execute('mkdir "'..data_path..'"') -- directory creation utility mkdir, the data path is
-- unlikely to contain special characters, and the
-- data path is only mutable by the admin.
os.execute('mkdir "'..data_path..'"')
end
file = io.open(data_path..id, "w") file = io.open(data_path..id, "w")
if not file then return end if not file then return end
end end