summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--xmake/core/base/path.lua3
-rw-r--r--xmake/modules/private/utils/batchcmds.lua16
2 files changed, 12 insertions, 7 deletions
diff --git a/xmake/core/base/path.lua b/xmake/core/base/path.lua
index 02e010d89..0248fed67 100644
--- a/xmake/core/base/path.lua
+++ b/xmake/core/base/path.lua
@@ -412,6 +412,9 @@ end
-- new a path instance
function path.new(p, transform)
+ if path.instance_of(p) then
+ p = tostring(p)
+ end
return _instance.new(p, transform)
end
diff --git a/xmake/modules/private/utils/batchcmds.lua b/xmake/modules/private/utils/batchcmds.lua
index 465fe301c..944507397 100644
--- a/xmake/modules/private/utils/batchcmds.lua
+++ b/xmake/modules/private/utils/batchcmds.lua
@@ -279,14 +279,16 @@ function batchcmds:compile(sourcefiles, objectfile, opt)
opt.target = self._TARGET
-- wrap path for sourcefiles, because we need to translate path for project generator
- if type(sourcefiles) == "table" then
- local sourcefiles_wrap = {}
- for _, sourcefile in ipairs(sourcefiles) do
- table.insert(sourcefiles_wrap, path(sourcefile))
+ if not path.instance_of(sourcefiles) then
+ if type(sourcefiles) == "table" then
+ local sourcefiles_wrap = {}
+ for _, sourcefile in ipairs(sourcefiles) do
+ table.insert(sourcefiles_wrap, path(sourcefile))
+ end
+ sourcefiles = sourcefiles_wrap
+ else
+ sourcefiles = path(sourcefiles)
end
- sourcefiles = sourcefiles_wrap
- else
- sourcefiles = path(sourcefiles)
end
-- load compiler and get compilation command