mirror of
https://github.com/octoleo/lsyncd.git
synced 2025-01-08 09:18:30 +00:00
fixed move event on layer 3 binary calls
This commit is contained in:
parent
42c1c4c62d
commit
a538447072
23
examples/lecho.lua
Normal file
23
examples/lecho.lua
Normal file
@ -0,0 +1,23 @@
|
|||||||
|
-----
|
||||||
|
-- User configuration file for lsyncd.
|
||||||
|
--
|
||||||
|
-- This example uses local bash commands to keep two local
|
||||||
|
-- directory trees in sync.
|
||||||
|
--
|
||||||
|
|
||||||
|
-----
|
||||||
|
-- for testing purposes. just echos what is happening.
|
||||||
|
--
|
||||||
|
echo = {
|
||||||
|
maxProcesses = 1,
|
||||||
|
delay = 1,
|
||||||
|
onStartup = "/bin/echo telling about ^source",
|
||||||
|
onAttrib = "/bin/echo attrib ^pathname",
|
||||||
|
onCreate = "/bin/echo create ^pathname",
|
||||||
|
onDelete = "/bin/echo delete ^pathname",
|
||||||
|
onModify = "/bin/echo modify ^pathname",
|
||||||
|
onMove = "/bin/echo move ^o.pathname -> ^d.pathname",
|
||||||
|
}
|
||||||
|
|
||||||
|
sync{echo, source="src", target="/path/to/trg/"}
|
||||||
|
|
12
lsyncd.lua
12
lsyncd.lua
@ -1686,7 +1686,7 @@ local functionWriter = (function()
|
|||||||
local haveEvent2 = false
|
local haveEvent2 = false
|
||||||
|
|
||||||
for ia, iv in ipairs(args) do
|
for ia, iv in ipairs(args) do
|
||||||
-- a list of arguments this arg is split to
|
-- a list of arguments this arg is being split into
|
||||||
local a = {{true, iv}}
|
local a = {{true, iv}}
|
||||||
-- goes through all translates
|
-- goes through all translates
|
||||||
for _, v in ipairs(transVars) do
|
for _, v in ipairs(transVars) do
|
||||||
@ -1696,6 +1696,9 @@ local functionWriter = (function()
|
|||||||
local pre, post =
|
local pre, post =
|
||||||
string.match(a[ai][2], "(.*)"..v[1].."(.*)")
|
string.match(a[ai][2], "(.*)"..v[1].."(.*)")
|
||||||
if pre then
|
if pre then
|
||||||
|
if v[3] > 1 then
|
||||||
|
haveEvent2 = true
|
||||||
|
end
|
||||||
if pre ~= "" then
|
if pre ~= "" then
|
||||||
table.insert(a, ai, {true, pre})
|
table.insert(a, ai, {true, pre})
|
||||||
ai = ai + 1
|
ai = ai + 1
|
||||||
@ -1710,16 +1713,17 @@ local functionWriter = (function()
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
-- concats the argument pieces into a string.
|
||||||
local as = ""
|
local as = ""
|
||||||
local first = true
|
local first = true
|
||||||
for _, v in ipairs(a) do
|
for _, v in ipairs(a) do
|
||||||
if not first then
|
if not first then
|
||||||
as = as .. " .. "
|
as = as.." .. "
|
||||||
end
|
end
|
||||||
if v[1] then
|
if v[1] then
|
||||||
as = as .. '"' .. v[2] .. '"'
|
as = as..'"'..v[2]..'"'
|
||||||
else
|
else
|
||||||
as = as .. v[2]
|
as = as..v[2]
|
||||||
end
|
end
|
||||||
first = false
|
first = false
|
||||||
end
|
end
|
||||||
|
Loading…
Reference in New Issue
Block a user