From a5def1ed021b1b5ba296fe22a7177f00285eaad9 Mon Sep 17 00:00:00 2001 From: ruki Date: Wed, 21 Aug 2019 00:44:06 +0800 Subject: fix some code styles --- xmake/actions/run/main.lua | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/xmake/actions/run/main.lua b/xmake/actions/run/main.lua index a3c1d5702..0ec951d41 100644 --- a/xmake/actions/run/main.lua +++ b/xmake/actions/run/main.lua @@ -30,15 +30,10 @@ import("core.platform.environment") import("devel.debugger") -- add search directories for all dependent shared libraries on windows -function _make_runpath(target) +function _make_runpath_on_windows(target) - if not (is_plat("windows") or (is_plat("mingw") and is_host("windows"))) then - return {} - end - - local searchdirs = hashset.new() local pathenv = {} - + local searchdirs = hashset.new() local function insert(dir) if not path.is_absolute(dir) then dir = path.absolute(dir, os.projectdir()) @@ -66,6 +61,8 @@ end -- run target function _do_run_target(target) + + -- only for binary program if target:targetkind() ~= "binary" then return end @@ -93,7 +90,10 @@ function _do_run_target(target) end end - os.addenv("PATH", table.unpack(_make_runpath(target))) + -- add search directories for all dependent shared libraries on windows + if is_plat("windows") or (is_plat("mingw") and is_host("windows")) then + os.addenv("PATH", table.unpack(_make_runpath_on_windows(target))) + end -- debugging? if option.get("debug") then -- cgit v1.3.1