aboutsummaryrefslogtreecommitdiff
path: root/builtin/mainmenu/pkgmgr.lua
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/mainmenu/pkgmgr.lua
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/mainmenu/pkgmgr.lua')
-rw-r--r--builtin/mainmenu/pkgmgr.lua51
1 files changed, 38 insertions, 13 deletions
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))