checkMod
Definition
-- @/lua/ge/extensions/core/modmanager.lua:180
local function checkMod(modname)
if modname == nil or mods[modname] == nil then return nil end
--if not FS:isMounted(mods[modname].fullpath) then log('D', 'checkMod', "Mods "..modname.." isn't mounted yet"); return nil end
mods[modname].valid = true
if mods[modname].modData.hashes then
local hashes = mods[modname].modData.hashes
for k,v in pairs(hashes) do
v[1] = v[1]:gsub("\\/","/")
if FS:fileExists(v[1]) then
local hash = FS:hashFile(v[1])
if hash ~= v[2] then
log('E', 'checkMod', "Mods "..modname.. " have a wrong file : "..v[1].. " original Hash="..v[2].." Current Hash="..hash)
mods[modname].valid = false
end
else
log('E', 'checkMod', "Mods "..modname.. " have a missing file : "..v[1])
mods[modname].valid = false
end
end
else
log('E', 'checkMod', "Mods "..modname.. " doesn't have hash manifest")
mods[modname].valid = false
end
local vehiculesTest =false
local vehName =""
mods[modname].conflict = {}
if mods[modname].modData.hashes ~= nil then
for k,v in pairs(mods[modname].modData.hashes) do
v[1] = v[1]:gsub("\\/","/")
if v[1]:match("vehicles/[%w]+") ~= nil and not vehiculesTest then
vehName =v[1]:match("vehicles/([%w]+)")
vehiculesTest = true
end
end
if vehiculesTest and vehName~="" then
local vfiles = FS:findFiles("/vehicles/"..vehName, "*", -1, true, false)
for _,vf in pairs(vfiles) do
if not modsOwnFile(modname,vf) then
table.insert(mods[modname].conflict,{file=vf, path=FS:getFileRealPath(vf)})
log('I', 'checkMod', "Mods "..modname.." have a file conflict "..dumps({file=vf, path=FS:getFileRealPath(vf)}) )
end
end
end
end
log('I', 'checkMod', "Mods "..modname.." valid= "..tostring(mods[modname].valid) .. " conflict="..#(mods[modname].conflict or {}) )
return mods[modname].valid and #mods[modname].conflict == 0
end
Callers
@/lua/ge/extensions/core/repository.lua
data.modname = core_modmanager.getModNameFromID(data.id)
data.update = true--core_modmanager.checkMod(data.modname)
data.conflict = nil--core_modmanager.getConflict(data.modname)