GE Lua Documentation

Press F to search!

workOffChangedMod

Definition


-- @/lua/ge/extensions/core/modmanager.lua:1164

local function workOffChangedMod(filename, type)
  -- check if we have mod unpacked
  local modname = getModNameFromPath(filename)
  if mods[modname] and mods[modname].unpackedPath and type == 'added' then
    safeDelete(filename)
    log('E', '', 'You have a unpacked version of [ '..modname..' ]. Need to be Packed before update')
    guihooks.trigger('modmanagerError', 'You have a unpacked version of [ '..modname..' ]. Need to be Packed before update')
    return
  end
  local dir, basefilename, ext = path.splitWithoutExt(filename)
  if ext == 'zip' and FS:fileExists(filename) and (type == 'added' or type == 'modified') then
    log('D', '', tostring(filename) .. ' : ' .. tostring(type) .. ' > ' .. tostring(ext))
    local mod, files = updateZIPEntry(filename)
    if not files or #files ==0 then return end
    if mod and mod.active ~= false then
      log('D', '', 'activateMod -- ' .. tostring(filename))
      activateMod(mod.modname)
    end
    FS:triggerFilesChanged(files) -- alert c++ of changed files
    stateChanged()
  end
end

Callers

@/lua/ge/extensions/core/modmanager.lua
  if filename:startswith("/mods/") and filename:endswith(".zip") and filename ~= persistencyfile and autoMount then
    workOffChangedMod(filename, type)
  end
@/lua/ge/extensions/core/repository.lua
    -- inspect / mount it
    --core_modmanager.workOffChangedMod(r.outfile, 'added')
    if completeCallback then completeCallback(r) end