From 76a73fadbea6a18e79d99621bf0490ba58bbd9b6 Mon Sep 17 00:00:00 2001 From: ruki Date: Thu, 10 Feb 2022 22:33:48 +0800 Subject: improve vs filter dir --- xmake/plugins/project/vsxmake/getinfo.lua | 13 +++++++++++++ 1 file changed, 13 insertions(+) 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), -- cgit v1.3.1