aboutsummaryrefslogtreecommitdiff
path: root/builtin/modmgr.lua
diff options
context:
space:
mode:
authorsapier <Sapier at GMX dot net>2013-07-16 20:56:18 +0200
committerPilzAdam <pilzadam@minetest.net>2013-07-22 18:10:00 +0200
commite3827fbc23d91b65e33a64dc029ff1ab1bf1b48b (patch)
treee232b222a62a085be3f5d15ca98ec7e5ceab63e9 /builtin/modmgr.lua
parent5160be91ae6af23cabec5c7412a1c2c45fc46afb (diff)
downloadminetest-e3827fbc23d91b65e33a64dc029ff1ab1bf1b48b.tar.xz
Fix background/overlay/footer/header handling
Add missing file headers
Diffstat (limited to 'builtin/modmgr.lua')
-rw-r--r--builtin/modmgr.lua41
1 files changed, 39 insertions, 2 deletions
diff --git a/builtin/modmgr.lua b/builtin/modmgr.lua
index a01187504..bf71d8b1d 100644
--- a/builtin/modmgr.lua
+++ b/builtin/modmgr.lua
@@ -541,8 +541,7 @@ end
--------------------------------------------------------------------------------
function modmgr.installmod(modfilename,basename)
- local modfile = identify_filetype(modfilename)
-
+ local modfile = modmgr.identify_filetype(modfilename)
local modpath = modmgr.extract(modfile)
if modpath == nil then
@@ -1008,3 +1007,41 @@ function modmgr.refresh_globals()
{}
)
end
+
+--------------------------------------------------------------------------------
+function modmgr.identify_filetype(name)
+
+ if name:sub(-3):lower() == "zip" then
+ return {
+ name = name,
+ type = "zip"
+ }
+ end
+
+ if name:sub(-6):lower() == "tar.gz" or
+ name:sub(-3):lower() == "tgz"then
+ return {
+ name = name,
+ type = "tgz"
+ }
+ end
+
+ if name:sub(-6):lower() == "tar.bz2" then
+ return {
+ name = name,
+ type = "tbz"
+ }
+ end
+
+ if name:sub(-2):lower() == "7z" then
+ return {
+ name = name,
+ type = "7z"
+ }
+ end
+
+ return {
+ name = name,
+ type = "ukn"
+ }
+end