diff --git a/ReadMe.md b/ReadMe.md index ee28189..80c6ff5 100644 --- a/ReadMe.md +++ b/ReadMe.md @@ -59,4 +59,4 @@ I will complain about it. - [x] Make some kind of JSON format / script to copy out specific mods for specific saves. - [ ] Function to open ContentDB for each mod in a list, or just a specific mod. -- [ ] Function to copy mods to a particular destination based on a pack. +- [x] Function to copy mods to a particular destination based on a pack. diff --git a/runner.lua b/runner.lua index df160c6..f4d48b9 100755 --- a/runner.lua +++ b/runner.lua @@ -4,6 +4,19 @@ local utility = require "utility" local data = utility.load_data("info.json") +local copy_pack_mods = function(pack_name, destination_path) + os.execute("mkdir -p " .. destination_path:enquote()) + + local pack_mods = data.packs[pack_name].mods + + for mod_name in pairs(pack_mods) do + local source = ("mods" .. utility.path_separator .. mod_name):enquote() + local target = (destination_path .. utility.path_separator .. mod_name):enquote() + + os.execute("cp -r " .. source .. " " .. target) + end +end + local check_dependencies = function(pack_name) local pack_mods = data.packs[pack_name].mods @@ -58,7 +71,7 @@ local standardize_data = function() end end -check_dependencies("Unnamed Luanti TechAge Pack") +copy_pack_mods("Unnamed Luanti TechAge Pack", "../Luanti_Servers/mods") -standardize_data() -utility.save_data(data) +-- standardize_data() +-- utility.save_data(data)