Export texture subdirectories
This commit is contained in:
parent
448bde1553
commit
79bfb64423
35
textures.lua
35
textures.lua
@ -1,20 +1,33 @@
|
||||
local count = 0
|
||||
local size = 0
|
||||
|
||||
function mtinfo.copy_texture_dir(src, target)
|
||||
minetest.mkdir(target)
|
||||
|
||||
local file_list = minetest.get_dir_list(src, false)
|
||||
for _, filename in pairs(file_list) do
|
||||
count = count+1
|
||||
size = size + mtinfo.copyfile(src .. "/" .. filename, target .. "/" .. filename)
|
||||
end
|
||||
|
||||
local dir_list = minetest.get_dir_list(src, true)
|
||||
for _, subdir in pairs(dir_list) do
|
||||
minetest.mkdir(target .. "/" .. subdir)
|
||||
mtinfo.copy_texture_dir(src .. "/" .. subdir, target .. "/" .. subdir)
|
||||
end
|
||||
end
|
||||
|
||||
function mtinfo.export_textures()
|
||||
for _, modname in ipairs(minetest.get_modnames()) do
|
||||
local modpath = minetest.get_modpath(modname)
|
||||
local destination_path = mtinfo.basepath .. "/textures"
|
||||
minetest.mkdir(destination_path)
|
||||
local modpath = minetest.get_modpath(modname)
|
||||
local destination_path = mtinfo.basepath .. "/textures"
|
||||
minetest.mkdir(destination_path)
|
||||
|
||||
if modpath then
|
||||
local texturepath = modpath .. "/textures"
|
||||
local dir_list = minetest.get_dir_list(texturepath)
|
||||
for _, filename in pairs(dir_list) do
|
||||
count = count + 1
|
||||
size = size + mtinfo.copyfile(texturepath .. "/" .. filename, destination_path .. "/" .. filename)
|
||||
end
|
||||
end
|
||||
if modpath then
|
||||
local source_path = modpath .. "/textures"
|
||||
print("[mtinfo] exporting " .. source_path .. " into " .. destination_path)
|
||||
mtinfo.copy_texture_dir(source_path, destination_path)
|
||||
end
|
||||
end
|
||||
print("[mtinfo] exported " .. count .. " textures (" .. size .. " bytes)")
|
||||
local data = {
|
||||
|
Loading…
x
Reference in New Issue
Block a user