diff options
Diffstat (limited to 'xmake')
| -rw-r--r-- | xmake/actions/run/main.lua | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/xmake/actions/run/main.lua b/xmake/actions/run/main.lua index e80072347..bd69d72f9 100644 --- a/xmake/actions/run/main.lua +++ b/xmake/actions/run/main.lua @@ -37,16 +37,25 @@ function _on_run_target(target) -- get kind if target:targetkind() == "binary" then + -- get the absolute target file path + local targetfile = path.absolute(target:targetfile()) + + -- enter the target directory + local oldir = os.cd(path.directory(target:targetfile())) + -- debugging? if option.get("debug") then -- debug it - debugger.run(target:targetfile(), option.get("arguments")) + debugger.run(targetfile, option.get("arguments")) else -- run it - os.execv(target:targetfile(), option.get("arguments")) + os.execv(targetfile, option.get("arguments")) end + + -- restore the previous directory + os.cd(oldir) end end |
