diff options
author | sfan5 <sfan5@live.de> | 2021-09-19 17:55:01 +0200 |
---|---|---|
committer | sfan5 <sfan5@live.de> | 2021-10-07 00:20:01 +0200 |
commit | 2b5075f0e2a8223cdb07f000b7e8f874416ed3a8 (patch) | |
tree | 74cfcd8e0f5e4d906e465960bc125829806f9095 /builtin/mainmenu/pkgmgr.lua | |
parent | 2d5b7b5fb48d182fbab8e4ad69e9a552a3c07c6e (diff) | |
download | minetest-2b5075f0e2a8223cdb07f000b7e8f874416ed3a8.tar.gz minetest-2b5075f0e2a8223cdb07f000b7e8f874416ed3a8.tar.bz2 minetest-2b5075f0e2a8223cdb07f000b7e8f874416ed3a8.zip |
Move archive extraction in content store to async job
Diffstat (limited to 'builtin/mainmenu/pkgmgr.lua')
-rw-r--r-- | builtin/mainmenu/pkgmgr.lua | 71 |
1 files changed, 0 insertions, 71 deletions
diff --git a/builtin/mainmenu/pkgmgr.lua b/builtin/mainmenu/pkgmgr.lua index 76d4a4123..d07dc019c 100644 --- a/builtin/mainmenu/pkgmgr.lua +++ b/builtin/mainmenu/pkgmgr.lua @@ -181,21 +181,6 @@ function pkgmgr.get_texture_packs() end -------------------------------------------------------------------------------- -function pkgmgr.extract(modfile) - if modfile.type == "zip" then - local tempfolder = os.tempfolder() - - if tempfolder ~= nil and - tempfolder ~= "" then - core.create_dir(tempfolder) - if core.extract_zip(modfile.name,tempfolder) then - return tempfolder - end - end - end - return nil -end - function pkgmgr.get_folder_type(path) local testfile = io.open(path .. DIR_DELIM .. "init.lua","r") if testfile ~= nil then @@ -658,23 +643,6 @@ function pkgmgr.install_dir(type, path, basename, targetpath) end -------------------------------------------------------------------------------- -function pkgmgr.install(type, modfilename, basename, dest) - local archive_info = pkgmgr.identify_filetype(modfilename) - local path = pkgmgr.extract(archive_info) - - if path == nil then - return nil, - fgettext("Install: file: \"$1\"", archive_info.name) .. "\n" .. - fgettext("Install: Unsupported file type \"$1\" or broken archive", - archive_info.type) - end - - local targetpath, msg = pkgmgr.install_dir(type, path, basename, dest) - core.delete_dir(path) - return targetpath, msg -end - --------------------------------------------------------------------------------- function pkgmgr.preparemodlist(data) local retval = {} @@ -818,45 +786,6 @@ function pkgmgr.refresh_globals() end -------------------------------------------------------------------------------- -function pkgmgr.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 - - --------------------------------------------------------------------------------- function pkgmgr.find_by_gameid(gameid) for i=1,#pkgmgr.games,1 do if pkgmgr.games[i].id == gameid then |