diff options
-rw-r--r-- | install.bat | 52 |
1 files changed, 26 insertions, 26 deletions
diff --git a/install.bat b/install.bat index 41474c47..32988022 100644 --- a/install.bat +++ b/install.bat | |||
@@ -526,33 +526,33 @@ local function get_msvc_env_setup_cmd() | |||
526 | return "" | 526 | return "" |
527 | end | 527 | end |
528 | 528 | ||
529 | local function look_for_lua_install () | 529 | local function get_possible_lua_directories() |
530 | print("Looking for Lua interpreter") | ||
531 | local directories | ||
532 | if vars.LUA_PREFIX then | 530 | if vars.LUA_PREFIX then |
533 | directories = { vars.LUA_PREFIX } | 531 | return {vars.LUA_PREFIX} |
534 | else | 532 | end |
535 | -- no prefix given, so use path | 533 | |
536 | directories = (os.getenv("PATH",";") or "") | 534 | -- No prefix given, so use PATH. |
537 | directories = directories:gsub(";+", ";") --remove all doubles | 535 | local path = os.getenv("PATH") or "" |
538 | directories = split_string(directories,";") | 536 | path = path:gsub(";+", ";") -- Remove duplicates. |
539 | -- if a path element ends with "\bin\" then remove it, as the searcher will check there anyway | 537 | local directories = split_string(path, ";") |
540 | for i, val in ipairs(directories) do | 538 | for i, dir in ipairs(directories) do |
541 | -- remove trailing backslash | 539 | -- Remove trailing backslashes, but not from a drive letter like `C:\`. |
542 | while val:sub(-1,-1) == "\\" and val:sub(-2,-1) ~= ":\\" do | 540 | dir = dir:gsub("([^:])\\+$", "%1") |
543 | val = val:sub(1,-2) | 541 | -- Remove trailing `bin` subdirectory, the searcher will check there anyway. |
544 | end | 542 | if dir:upper():match("[:\\]BIN$") then |
545 | -- remove trailing 'bin' | 543 | dir = dir:sub(1, -5) |
546 | if val:upper():sub(-4,-1) == "\\BIN" or val:upper():sub(-4,-1) == ":BIN" then | ||
547 | val = val:sub(1,-5) | ||
548 | end | ||
549 | directories[i] = val | ||
550 | end | 544 | end |
551 | -- finaly add some other default paths | 545 | directories[i] = dir |
552 | table.insert(directories, [[c:\lua5.1.2]]) | ||
553 | table.insert(directories, [[c:\lua]]) | ||
554 | table.insert(directories, [[c:\kepler\1.1]]) | ||
555 | end | 546 | end |
547 | -- Finally add some other default paths. | ||
548 | table.insert(directories, [[c:\lua5.1.2]]) | ||
549 | table.insert(directories, [[c:\lua]]) | ||
550 | table.insert(directories, [[c:\kepler\1.1]]) | ||
551 | return directories | ||
552 | end | ||
553 | |||
554 | local function look_for_lua_install () | ||
555 | print("Looking for Lua interpreter") | ||
556 | if vars.LUA_BINDIR and vars.LUA_LIBDIR and vars.LUA_INCDIR then | 556 | if vars.LUA_BINDIR and vars.LUA_LIBDIR and vars.LUA_INCDIR then |
557 | if look_for_interpreter(vars.LUA_BINDIR) and | 557 | if look_for_interpreter(vars.LUA_BINDIR) and |
558 | look_for_link_libraries(vars.LUA_LIBDIR) and | 558 | look_for_link_libraries(vars.LUA_LIBDIR) and |
@@ -569,8 +569,8 @@ local function look_for_lua_install () | |||
569 | end | 569 | end |
570 | return false | 570 | return false |
571 | end | 571 | end |
572 | 572 | ||
573 | for _, directory in ipairs(directories) do | 573 | for _, directory in ipairs(get_possible_lua_directories()) do |
574 | print(" checking " .. directory) | 574 | print(" checking " .. directory) |
575 | if exists(directory) then | 575 | if exists(directory) then |
576 | if look_for_interpreter(directory) then | 576 | if look_for_interpreter(directory) then |