updateZipMod
Definition
-- @/lua/ge/extensions/core/modmanager.lua:1382
local function updateZipMod(oldFileName,newFileName)
local oldMod = nil
oldMod = getModDB( getModNameFromPath(oldFileName) )
if oldMod == nil then
for mn,md in pairs(mods) do
if m.filename == oldFileName then
oldMod = md
break
end
end
if oldMod == nil and not FS:fileExists("/mods/"..oldFileName) then
guihooks.trigger('modmanagerError', "updateZipMod: Old ZIP not found")
log("E","updateZipMod","Old file not found ")
return
end
end
if oldMod then
deleteMod(getModNameFromPath(oldFileName))
else
if FS:isMounted("/mods/"..oldFileName) then
FS:unmount("/mods/"..oldFileName)
log("E","updateZipMod","Unmounting a mod that is not in the mod DB. This is Wrong!. Zip="..oldFileName)
end
if FS:removeFile("/mods/"..oldFileName) ~= 0 then
guihooks.trigger('modmanagerError', "updateZipMod: Failed to delete old ZIP")
log("E","updateZipMod","Failed to delete old ZIP "..tostring(oldFileName))
return
end
end
if FS:renameFile("/mods/"..newFileName,"/mods/"..oldFileName) ~= 0 then
guihooks.trigger('modmanagerError', "updateZipMod: Failed to rename ZIP")
log("E","updateZipMod","Failed to rename ZIP ''"..tostring(oldFileNamex).."' > '"..newFileName.."'")
return
end
end
Callers
@/lua/ge/extensions/core/commandhandler.lua
log('I', logTag, "updateZipMod '" .. tostring(tmp[1]).. "' with new '"..tostring(tmp[2]) .."'")
extensions.core_modmanager.updateZipMod(tmp[1], tmp[2])
return