summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--xmake/core/base/winos.lua6
1 files changed, 5 insertions, 1 deletions
diff --git a/xmake/core/base/winos.lua b/xmake/core/base/winos.lua
index 30a2d1eba..f2bc7b7d4 100644
--- a/xmake/core/base/winos.lua
+++ b/xmake/core/base/winos.lua
@@ -188,7 +188,11 @@ function winos.cmdargv(argv, opt)
-- -Dxxx
-- foo.obj
--
- if idx + 1 <= #argv and arg:find("^[-/]") and not arg1:find("^[-/]") then
+
+ -- if host is not Windows, paths may start with '/', which conflicts with '/<argname>'
+ -- note that checking if the next argument ends with '.json' will only work for /sourceDependencies
+ -- other arguments will remain broken, perhaps we should discuss a better solution
+ if idx + 1 <= #argv and arg:find("^[-/]") and (os.is_host("windows") and (not arg1:find("^[-/]")) or (arg1:find("%.json$"))) then
f:write(os.args(arg, {escape = opt.escape}) .. " ")
f:write(os.args(arg1, {escape = opt.escape}) .. "\n")
idx = idx + 2