1if not modules then modules = { } end modules ['libs-imp-kpse'] = {
2 version = 1.001,
3 comment = "companion to luat-imp-kpse.mkxl",
4 author = "Hans Hagen, PRAGMA-ADE, Hasselt NL",
5 copyright = "PRAGMA ADE / ConTeXt Development Team",
6 license = "see context related readme files"
7}
8
9
10
11
12
13local libname = "kpse"
14local libfile = (os.platform == "win64" and "kpathsea*w64")
15 or (os.platform == "win32" and "kpathsea*w32")
16 or "libkpathsea"
17local libkpse = resolvers.libraries.validoptional(libname)
18
19if package.loaded[libname] then
20 return package.loaded[libname]
21end
22
23
24
25
26
27
28
29
30
31local function okay()
32 if libkpse and resolvers.libraries.optionalloaded(libname,libfile) then
33 okay = function() return true end
34 else
35 okay = function() return false end
36 end
37 return okay()
38end
39
40local kpse = { }
41
42for k, v in next, libkpse do
43 kpse[k] = function(...) if okay() then return v(...) end end
44end
45
46
47
48package.loaded[libname] = kpse
49
50optional.loaded.kpse = kpse
51
52
53
54
55
56
57
58return kpse
59 |