summaryrefslogtreecommitdiff
path: root/builtin
diff options
context:
space:
mode:
authorrubenwardy <rw@rubenwardy.com>2019-01-06 09:23:35 +0000
committerLoïc Blot <nerzhul@users.noreply.github.com>2019-01-06 10:23:35 +0100
commit70bf3439ab9f3cb826d76111552dcc38678fcf3d (patch)
tree1c56f6667e84b3f979c0b1bfcbc18db7cfbf2cc7 /builtin
parent3a9fe2bd5b0c112150eb20e375729aea7a4776f4 (diff)
downloadminetest-70bf3439ab9f3cb826d76111552dcc38678fcf3d.tar.gz
minetest-70bf3439ab9f3cb826d76111552dcc38678fcf3d.tar.bz2
minetest-70bf3439ab9f3cb826d76111552dcc38678fcf3d.zip
Deprecate modpack.txt and use modpack.conf instead (#7892)
* Deprecate modpack.txt and use modpack.conf instead
Diffstat (limited to 'builtin')
-rw-r--r--builtin/mainmenu/dlg_contentstore.lua9
-rw-r--r--builtin/mainmenu/pkgmgr.lua51
2 files changed, 46 insertions, 14 deletions
diff --git a/builtin/mainmenu/dlg_contentstore.lua b/builtin/mainmenu/dlg_contentstore.lua
index bab2c73f3..414c26853 100644
--- a/builtin/mainmenu/dlg_contentstore.lua
+++ b/builtin/mainmenu/dlg_contentstore.lua
@@ -76,10 +76,17 @@ local function start_install(calling_dialog, package)
if not path then
gamedata.errormessage = msg
else
+ core.log("action", "Installed package to " .. path)
+
local conf_path
local name_is_title = false
if result.package.type == "mod" then
- conf_path = path .. DIR_DELIM .. "mod.conf"
+ local actual_type = pkgmgr.get_folder_type(path)
+ if actual_type.type == "modpack" then
+ conf_path = path .. DIR_DELIM .. "modpack.conf"
+ else
+ conf_path = path .. DIR_DELIM .. "mod.conf"
+ end
elseif result.package.type == "game" then
conf_path = path .. DIR_DELIM .. "game.conf"
name_is_title = true
diff --git a/builtin/mainmenu/pkgmgr.lua b/builtin/mainmenu/pkgmgr.lua
index ebd8ece6b..f6015ef72 100644
--- a/builtin/mainmenu/pkgmgr.lua
+++ b/builtin/mainmenu/pkgmgr.lua
@@ -25,27 +25,46 @@ function get_mods(path,retval,modpack)
local toadd = {}
retval[#retval + 1] = toadd
- local mod_conf = Settings(prefix .. DIR_DELIM .. "mod.conf"):to_table()
- if mod_conf.name then
- name = mod_conf.name
+ -- Get config file
+ local mod_conf
+ local modpack_conf = io.open(prefix .. DIR_DELIM .. "modpack.conf")
+ if modpack_conf then
+ toadd.is_modpack = true
+ modpack_conf:close()
+
+ mod_conf = Settings(prefix .. DIR_DELIM .. "modpack.conf"):to_table()
+ if mod_conf.name then
+ name = mod_conf.name
+ end
+ else
+ mod_conf = Settings(prefix .. DIR_DELIM .. "mod.conf"):to_table()
+ if mod_conf.name then
+ name = mod_conf.name
+ end
end
+ -- Read from config
toadd.name = name
toadd.author = mod_conf.author
toadd.release = tonumber(mod_conf.release or "0")
toadd.path = prefix
toadd.type = "mod"
- if modpack ~= nil and modpack ~= "" then
+ -- Check modpack.txt
+ -- Note: modpack.conf is already checked above
+ local modpackfile = io.open(prefix .. DIR_DELIM .. "modpack.txt")
+ if modpackfile then
+ modpackfile:close()
+ toadd.is_modpack = true
+ end
+
+ -- Deal with modpack contents
+ if modpack and modpack ~= "" then
toadd.modpack = modpack
- else
- local modpackfile = io.open(prefix .. DIR_DELIM .. "modpack.txt")
- if modpackfile then
- modpackfile:close()
- toadd.type = "modpack"
- toadd.is_modpack = true
- get_mods(prefix, retval, name)
- end
+ elseif toadd.is_modpack then
+ toadd.type = "modpack"
+ toadd.is_modpack = true
+ get_mods(prefix, retval, name)
end
end
end
@@ -114,6 +133,12 @@ function pkgmgr.get_folder_type(path)
return { type = "mod", path = path }
end
+ testfile = io.open(path .. DIR_DELIM .. "modpack.conf","r")
+ if testfile ~= nil then
+ testfile:close()
+ return { type = "modpack", path = path }
+ end
+
testfile = io.open(path .. DIR_DELIM .. "modpack.txt","r")
if testfile ~= nil then
testfile:close()
@@ -422,7 +447,7 @@ function pkgmgr.install_dir(type, path, basename, targetpath)
else
local clean_path = nil
if basename ~= nil then
- clean_path = "mp_" .. basename
+ clean_path = basename
end
if not clean_path then
clean_path = get_last_folder(cleanup_path(basefolder.path))