function fileExists(fname)
local f = io.open(fname, "r")
if f then
f:close()
return true
else
return false
end
end
function dependencyCheck()
if not isinit then return false end
local dependencies = {
luaSocket = {
"%U/AppData/Local/Mudlet/socket/core.dll",
"%H/socket/core.dll"
},
}
local dependResult = {}
local userFolder = string.match(getMudletHomeDir(), "^(.-)[\\/]%.config")
local homeDir = getMudletHomeDir()
for lib, locations in pairs(dependencies) do
dependResult[lib] = false
for _, location in ipairs(locations) do
local fullpath = location:gsub("%%U", userFolder):gsub("%%H", homeDir)
if fileExists(fullpath) then
dependResult[lib] = true
break
else
--disconnect()
--warning("LuaSocket not found: Connection aborted.\n")
--local putthisinyourpipe = tempTimer(1, [[info("Downloading package files...");packageDownload()]])
end
end
end
isinit = true
return dependResult
end
function packageDownload()
downloadFile(getMudletHomeDir() .. "/socket.zip", "http://api.pharanyx.com/saracen/socket.zip")
end