Fix problem when project directory has a trailing slash

This commit is contained in:
Francesco Abbate
2021-01-10 12:56:15 +01:00
parent 7f9e4e4984
commit fcf763fe9c
4 changed files with 28 additions and 14 deletions
+7
View File
@@ -196,6 +196,13 @@ function common.serialize(val)
end
function common.basename(path)
-- a path should never end by / or \ except if it is '/' (unix root) or
-- 'X:\' (windows drive)
return path:match("[^\\/]+$") or path
end
function common.home_encode(text)
if HOME then
local n = #HOME