properly escape lua special chars in 'path.relative' (closes #315)

This commit is contained in:
bhagwan 2022-01-18 12:39:07 -08:00
parent f466e20196
commit 7c4c61acb9

View File

@ -47,7 +47,9 @@ function M.extension(path)
end
function M.to_matching_str(path)
return path:gsub('(%-)', '(%%-)'):gsub('(%.)', '(%%.)'):gsub('(%_)', '(%%_)')
-- return path:gsub('(%-)', '(%%-)'):gsub('(%.)', '(%%.)'):gsub('(%_)', '(%%_)')
-- above is missing other lua special chars like '+' etc (#315)
return utils.lua_regex_escape(path)
end
function M.join(paths)