0
|
1 require "path"
|
|
2 require "dynload"
|
|
3
|
|
4 function init(env,syspath)
|
|
5 local env = env or "LIBPATH"
|
|
6 local syspath = syspath or ";?.framework/?;lib?.dylib;"
|
|
7 print("env\t="..env)
|
|
8 print("syspath\t="..syspath)
|
|
9 local path = pathinit(env,syspath)
|
|
10 print("path\t="..path)
|
|
11 return(path)
|
|
12 end
|
|
13
|
|
14 local mypath = init()
|
|
15
|
|
16 function findlib(name)
|
|
17 local found, location = pathfind(mypath, name, loadlib)
|
|
18 if found then
|
|
19 print("found at " .. location .. " ( object= " .. tostring(found) .. " )" )
|
|
20 else
|
|
21 print("FAILED: findlib('"..name.."'). tried:\n - " .. table.concat(location,"\n - ") .. "\n" )
|
|
22 end
|
|
23 end
|
|
24
|
|
25 function trylib(name)
|
|
26 print("trylib",name)
|
|
27 local status, msg = pcall( findlib, name )
|
|
28 print(status,msg)
|
|
29 end
|
|
30
|
|
31 trylib("GL")
|
|
32 trylib("OpenGL")
|
|
33 trylib("SDL")
|
|
34 trylib("Bla")
|
|
35
|
|
36
|