summaryrefslogtreecommitdiff
path: root/xmake/plugins/project/vstudio/impl/vs201x.lua
diff options
context:
space:
mode:
authorruki <[email protected]>2022-05-22 11:28:58 +0800
committerruki <[email protected]>2022-05-22 11:28:58 +0800
commitc990367664d6389990cb37c5a0ae4e9157d7b24e (patch)
tree571c4bcab2ba96b9e8e4b93435bf8d0844d8fdff /xmake/plugins/project/vstudio/impl/vs201x.lua
parent34a0c28d63953f48ab4d9e552a46dd70b787d069 (diff)
improve path for cmake/vs
Diffstat (limited to 'xmake/plugins/project/vstudio/impl/vs201x.lua')
-rw-r--r--xmake/plugins/project/vstudio/impl/vs201x.lua15
1 files changed, 9 insertions, 6 deletions
diff --git a/xmake/plugins/project/vstudio/impl/vs201x.lua b/xmake/plugins/project/vstudio/impl/vs201x.lua
index 8752d49ed..ce07549c0 100644
--- a/xmake/plugins/project/vstudio/impl/vs201x.lua
+++ b/xmake/plugins/project/vstudio/impl/vs201x.lua
@@ -85,7 +85,9 @@ function _get_command_string(cmd, vcxprojdir)
if cmd.program then
local argv = {}
for _, v in ipairs(table.join(cmd.program, cmd.argv)) do
- if path.is_absolute(v) then
+ if path.instance_of(v) then
+ v = v:clone():set(_translate_path(v:rawstr(), vcxprojdir)):str()
+ elseif path.is_absolute(v) then
v = _translate_path(v, vcxprojdir)
end
table.insert(argv, v)
@@ -96,15 +98,16 @@ function _get_command_string(cmd, vcxprojdir)
end
return command
elseif kind == "cp" then
- return string.format("copy /Y \"%s\" \"%s\"", cmd.srcpath, cmd.dstpath)
+ return string.format("copy /Y \"%s\" \"%s\"", _translate_path(cmd.srcpath, vcxprojdir), _translate_path(cmd.dstpath, vcxprojdir))
elseif kind == "rm" then
- return string.format("del /F /Q \"%s\" || rmdir /S /Q \"%s\"", cmd.filepath, cmd.filepath)
+ return string.format("del /F /Q \"%s\" || rmdir /S /Q \"%s\"", _translate_path(cmd.filepath, vcxprojdir), _translate_path(cmd.filepath, vcxprojdir))
elseif kind == "mv" then
- return string.format("rename \"%s\" \"%s\"", cmd.srcpath, cmd.dstpath)
+ return string.format("rename \"%s\" \"%s\"", _translate_path(cmd.srcpath, vcxprojdir), _translate_path(cmd.dstpath, vcxprojdir))
elseif kind == "cd" then
- return string.format("cd \"%s\"", cmd.dir)
+ return string.format("cd \"%s\"", _translate_path(cmd.dir, vcxprojdir))
elseif kind == "mkdir" then
- return string.format("if not exist \"%s\" mkdir \"%s\"", cmd.dir, cmd.dir)
+ local dir = _translate_path(cmd.dir, vcxprojdir)
+ return string.format("if not exist \"%s\" mkdir \"%s\"", dir, dir)
elseif kind == "show" then
return string.format("echo %s", cmd.showtext)
end