Commit: 85e7f389e8ac832eab0d3686d00f234ab89a16fb
Parent: daf7427fba3211d5dda2bbca3fcb6b993541c64f
Author: Randy Palamar
Date: Tue, 2 Jan 2024 18:03:37 -0700
fix tail component replacement in man() for old lua
gsub/gmatch behaved differently prior to lua5.3 and thus cannot be
used with the same semantics in luajit/older lua.
Diffstat:
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/ninja.lua b/ninja.lua
@@ -489,8 +489,9 @@ function man(srcs, section)
if not src:match('^[$/]') then
src = '$srcdir/'..src
end
+ local i = src:reverse():find('.', 1, true)
local srcsection = section or src:match('[^.]*$')
- local outsrc = src:gsub('[^.]*$', srcsection)
+ local outsrc = src:sub(1, #src - i + 1) .. srcsection
file('share/man/man'..srcsection..'/'..outsrc:match('[^/]*$'), '644', src)
end
end