[Lua] Overhaul Lua configure probes
[xapian.git] / xapian-bindings / lua / unpick-cpath.lua
blob80b5624f7df04225e448f90e78a2a714200ac90d
1 require("package")
2 require("io")
3 so = string.lower(arg[1])
4 for e in string.gmatch(string.gsub(package.cpath,"\\","/"), "[^;]*") do
5 io.stderr:write("cpath entry: "..e.."\n")
6 l,s = string.match(e, "^(/.*)/%?(%.%a+)$")
7 if l == nil then
8 l,s = string.match(e, "^(%a:/.*)/%?(%.%a+)$")
9 end
10 if l ~= nil and string.lower(s) ~= ".lua" then
11 if so == "" or string.lower(s) == so then
12 print(l..";"..s)
13 break
14 end
15 end
16 end