Fixed handling of exact path matches in vpath building

This commit is contained in:
Jason Perkins 2012-09-18 11:24:18 -04:00
parent f7cb37fc3c
commit 891a1dbcd6
2 changed files with 16 additions and 6 deletions

View File

@ -470,10 +470,14 @@
-- does the filename match this vpath pattern?
local i = filename:find(path.wildcards(pattern))
if i == 1 then
-- yes; trim the leading portion of the path
-- yes; trim the pattern out of the target file's path
local leaf
i = pattern:find("*", 1, true) or (pattern:len() + 1)
local leaf = filename:sub(i)
if i < filename:len() then
leaf = filename:sub(i)
else
leaf = path.getname(filename)
end
if leaf:startswith("/") then
leaf = leaf:sub(2)
end
@ -491,7 +495,6 @@
end
vpath = path.join(stem, leaf)
end
end
end

View File

@ -65,6 +65,13 @@
test.isequal("sources/hello.c", project.getvpath(prj, cfg.files[1]))
end
function suite.ExactFilenameMatch()
files { "src/hello.c" }
vpaths { ["sources"] = "src/hello.c" }
prepare()
test.isequal("sources/hello.c", project.getvpath(prj, cfg.files[1]))
end
--
-- Test wildcard patterns