new inotifies work now

This commit is contained in:
Axel Kittenberger 2010-11-20 13:42:27 +00:00
parent c3b15c2aef
commit 58b4f21d56

View File

@ -1409,10 +1409,7 @@ local function splitPath(path, root)
local rl = #root local rl = #root
local sp = string.sub(path, 1, rl) local sp = string.sub(path, 1, rl)
print("split", path, root, sp)
if sp == root then if sp == root then
print("splited", path, root, string.sub(path, rl, -1))
return string.sub(path, rl, -1) return string.sub(path, rl, -1)
else else
return nil return nil
@ -1517,7 +1514,7 @@ local Inotifies = (function()
-- @param root root dir to watch -- @param root root dir to watch
-- @param sync Object to receive events -- @param sync Object to receive events
-- --
local function addSync(root, sync) local function addSync(sync, root)
if syncRoots[sync] then if syncRoots[sync] then
error("internal fail, duplicate sync in Inotifies()") error("internal fail, duplicate sync in Inotifies()")
end end
@ -1560,10 +1557,12 @@ local Inotifies = (function()
log("Inotify", "event belongs to unknown watch descriptor.") log("Inotify", "event belongs to unknown watch descriptor.")
return return
end end
path = path..filename
local path2 = wd2 and wdpaths[wd2] local path2 = wd2 and wdpaths[wd2]
-- set to true if at least one sync wants recursive data if path2 and filename2 then
local recurse = false path2 = path2..filename2
end
for sync, root in pairs(syncRoots) do repeat for sync, root in pairs(syncRoots) do repeat
local relative = splitPath(path, root) local relative = splitPath(path, root)
@ -1576,13 +1575,6 @@ local Inotifies = (function()
break -- continue break -- continue
end end
--- checks if this sync is interested in subdirs
if isdir then
recurse = recurse or
sync.config.subdirs or
sync.config.subdirs == nil
end
-- makes a copy of etype to possibly change it -- makes a copy of etype to possibly change it
local etyped = etype local etyped = etype
if etyped == 'Move' then if etyped == 'Move' then
@ -2217,7 +2209,7 @@ function runner.initialize()
-- runs through the Syncs created by users -- runs through the Syncs created by users
for _, s in Syncs.iwalk() do for _, s in Syncs.iwalk() do
Inotifies.addSync(s.source, "", true, s, nil, nil) Inotifies.addSync(s, s.source)
if s.config.init then if s.config.init then
InletControl.setSync(s) InletControl.setSync(s)
s.config.init(Inlet) s.config.init(Inlet)