summaryrefslogtreecommitdiff
path: root/builtin/modmgr.lua
diff options
context:
space:
mode:
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