-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathfunctions.lua
More file actions
31 lines (24 loc) · 868 Bytes
/
functions.lua
File metadata and controls
31 lines (24 loc) · 868 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
function CheckFiles(path, name, noReload)
lastUpdates[path] = lastUpdates[path] or {}
local files = cFile:GetFolderContents(path)
for _, filename in ipairs(files) do
local last_update = cFile:GetLastModificationTime(path .. "/" .. filename)
local recorded_update = lastUpdates[path][filename]
if (last_update and recorded_update) and (last_update > recorded_update) and (not noReload) then
LOG("Reloading " .. name)
lastUpdates[path][filename] = last_update
cPluginManager:Get():ReloadPlugin(name)
return
end
lastUpdates[path][filename] = last_update
end
end
function CheckPlugins(noReload)
cPluginManager:ForEachPlugin(function(plugin)
local path = "./" .. plugin:GetLocalFolder()
local name = plugin:GetName()
if plugin:GetStatus() == cPluginManager.psLoaded then
CheckFiles(path, name, noReload)
end
end)
end