From 12d4f43d0f923ec1691a22492a80e947497b9512 Mon Sep 17 00:00:00 2001 From: Axel Kittenberger Date: Wed, 4 Jan 2017 11:24:55 +0100 Subject: [PATCH] realtive paths do not start with a slash --- lsyncd.lua | 27 ++++++++++++++++++++++++--- 1 file changed, 24 insertions(+), 3 deletions(-) diff --git a/lsyncd.lua b/lsyncd.lua index 5adab83..2d63c59 100644 --- a/lsyncd.lua +++ b/lsyncd.lua @@ -1283,7 +1283,14 @@ local InletFactory = ( function ( event ) - return getPath( event ) + local p = getPath( event ) + + if string.byte( path, 1 ) == 47 + then + p = string.sub( p, 2, -1 ) + end + + return p end, -- @@ -1294,7 +1301,14 @@ local InletFactory = ( function ( event ) - return string.match( getPath( event ), '^(.*/)[^/]+/?' ) or '' + local p = getPath( event ) + + if string.byte( path, 1 ) == 47 + then + p = string.sub( p, 2, -1 ) + end + + return string.match( p, '^(.*/)[^/]+/?' ) or '' end, -- @@ -1305,7 +1319,14 @@ local InletFactory = ( function ( event ) - return cutSlash( getPath( event ) ) + local p = getPath( event ) + + if string.byte( path, 1 ) == 47 + then + p = string.sub( p, 2, -1 ) + end + + return cutSlash( p ) end, --