From 1adda57f6d311e181998918ce27bdd5bd743975e Mon Sep 17 00:00:00 2001 From: Peter Melnichenko Date: Sun, 21 Aug 2016 18:36:25 +0300 Subject: Refactor look_for_link_libraries in install.bat One side effect should be that inferred LIB_DIR has no trailing backslash. --- install.bat | 30 +++++++++++++++--------------- 1 file changed, 15 insertions(+), 15 deletions(-) diff --git a/install.bat b/install.bat index 1bce4c53..0f377d8d 100644 --- a/install.bat +++ b/install.bat @@ -316,30 +316,30 @@ local function look_for_interpreter(directory) return false end -local function look_for_link_libraries (directory) +local function look_for_link_libraries(directory) + local directories if vars.LUA_LIBDIR then - for name in vars.LUA_LIB_NAMES:gmatch("[^%s]+") do - print(S" checking for $LUA_LIBDIR\\"..name) - if exists(vars.LUA_LIBDIR.."\\"..name) then - vars.LUA_LIBNAME = name - print(" Found "..name) - return true - end - end - die(S"link library (one of; $LUA_LIB_NAMES) not found in $LUA_LIBDIR") + directories = {vars.LUA_LIBDIR} + else + directories = {directory, directory .. "\\lib", directory .. "\\bin"} end - for _, e in ipairs{ [[\]], [[\lib\]], [[\bin\]]} do + for _, dir in ipairs(directories) do for name in vars.LUA_LIB_NAMES:gmatch("[^%s]+") do - print(" checking for "..directory..e.."\\"..name) - if exists(directory..e.."\\"..name) then - vars.LUA_LIBDIR = directory .. e + local full_name = dir .. "\\" .. name + print(" checking for " .. full_name) + if exists(full_name) then + vars.LUA_LIBDIR = dir vars.LUA_LIBNAME = name - print(" Found "..name) + print(" Found " .. name) return true end end end + + if vars.LUA_LIBDIR then + die(S"link library (one of; $LUA_LIB_NAMES) not found in $LUA_LIBDIR") + end return false end -- cgit v1.2.3-55-g6feb