summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorruki <[email protected]>2022-02-10 22:33:48 +0800
committerruki <[email protected]>2022-02-10 22:33:48 +0800
commit76a73fadbea6a18e79d99621bf0490ba58bbd9b6 (patch)
tree904cfea3a4f2c5ff97d383a41b75b9d959720c32
parenta2b9ff399008e287a09f10d0201e0da68f05899b (diff)
improve vs filter dir
-rw-r--r--xmake/plugins/project/vsxmake/getinfo.lua13
1 files changed, 13 insertions, 0 deletions
diff --git a/xmake/plugins/project/vsxmake/getinfo.lua b/xmake/plugins/project/vsxmake/getinfo.lua
index e9403cb35..83a8b6132 100644
--- a/xmake/plugins/project/vsxmake/getinfo.lua
+++ b/xmake/plugins/project/vsxmake/getinfo.lua
@@ -68,6 +68,17 @@ function _vs_arch(arch)
return arch
end
+-- strip dot directories, e.g. ..\..\.. => ..
+-- @see https://github.com/xmake-io/xmake/issues/2039
+function _strip_dotdirs(dir)
+ local count
+ dir, count = dir:gsub("%.%.[\\/]%.%.", "..")
+ if count > 0 then
+ dir = _strip_dotdirs(dir)
+ end
+ return dir
+end
+
function _make_dirs(dir)
if dir == nil then
return ""
@@ -464,6 +475,8 @@ function main(outputdir, vsinfo)
target.headerfiles = table.imap(target.headerfiles, function(_, v) return path.relative(v, root) end)
for _, f in ipairs(table.join(target.sourcefiles, target.headerfiles)) do
local dir = path.directory(f)
+ -- @see https://github.com/xmake-io/xmake/issues/2039
+ dir = _strip_dotdirs(dir)
target._paths[f] =
{
path = _escape(f),