if secure.enable_security is disabled, schems from all worlds are offered

master
Sokomine 2016-04-27 23:27:09 +02:00
parent 94b1936320
commit 566a51f801
1 changed files with 24 additions and 17 deletions

View File

@ -75,6 +75,28 @@ local build_chest_check_all_directories_mods_and_modpacks = function( path, menu
end
end
build_chest.add_files_from_path = function( worldpath, worldname )
-- get list of subdirectories
local path = worldpath..'/'..worldname;
local subdir_list = minetest.get_dir_list( path, true );
if( not( subdir_list )) then
return;
end
for _,subdir in ipairs( subdir_list ) do
if( subdir=='schems' ) then
local file_list = minetest.get_dir_list( path..'/schems', false );
for _,filename in ipairs( file_list ) do
build_chest_add_files_to_menu_from_directory(
filename,
path..'/schems/',
'import from world',
'landscape backups',
{'OVERWRITE THIS', worldname });
end
end
end
end
local build_chest_check_all_directories = function()
-- find the name of the directory directly above the current worldpath
@ -106,27 +128,12 @@ local build_chest_check_all_directories = function()
end
end
--]]
worldpath = string.sub( worldpath, 1, string.len( worldpath )-p );
-- worldpath = string.sub( worldpath, 1, string.len( worldpath )-p );
-- locate .mts, .wem and .we files in the worlds/WORLDNAME/schems/* folders
local d1 = minetest.get_dir_list( worldpath, true );
for _,worldname in ipairs( d1 ) do
-- get list of subdirectories
local d2 = minetest.get_dir_list( worldpath..'/'..worldname, true );
for _,subdir in ipairs( d2 ) do
if( subdir=='schems' ) then
local d3 = minetest.get_dir_list( worldpath..'/'..worldname..'/schems', false );
for _,filename in ipairs( d3 ) do
build_chest_add_files_to_menu_from_directory(
filename,
worldpath..'/'..worldname..'/schems/',
'import from world',
'landscape backups',
{'OVERWRITE THIS', worldname });
end
end
end
build_chest.add_files_from_path( worldpath, worldname );
end
local main_path = string.sub( worldpath, 1, string.len(worldpath)-string.len('/worlds'));