1if not modules then modules = { } end modules ['data-tmf'] = {
2 version = 1.001,
3 comment = "companion to luat-lib.mkiv",
4 author = "Hans Hagen, PRAGMA-ADE, Hasselt NL",
5 copyright = "PRAGMA ADE / ConTeXt Development Team",
6 license = "see context related readme files"
7}
8
9local resolvers = resolvers
10
11local report_tds = logs.reporter("resolvers","tds")
12
13
14
15
16
17
18function resolvers.load_tree(tree,resolve)
19 if type(tree) == "string" and tree ~= "" then
20
21 local getenv, setenv = resolvers.getenv, resolvers.setenv
22
23
24 local texos = "texmf-" .. os.platform
25
26 local oldroot = environment.texroot
27 local newroot = file.collapsepath(tree)
28
29 local newtree = file.join(newroot,texos)
30 local newpath = file.join(newtree,"bin")
31
32 if not lfs.isdir(newtree) then
33 report_tds("no %a under tree %a",texos,tree)
34 os.exit()
35 end
36 if not lfs.isdir(newpath) then
37 report_tds("no '%s/bin' under tree %a",texos,tree)
38 os.exit()
39 end
40
41 local texmfos = newtree
42
43 environment.texroot = newroot
44 environment.texos = texos
45 environment.texmfos = texmfos
46
47
48
49
50
51
52
53
54 if resolve then
55
56 resolvers.luacnfspec = resolvers.resolve(resolvers.luacnfspec)
57 end
58
59 setenv('SELFAUTOPARENT', newroot)
60 setenv('SELFAUTODIR', newtree)
61 setenv('SELFAUTOLOC', newpath)
62 setenv('TEXROOT', newroot)
63 setenv('TEXOS', texos)
64 setenv('TEXMFOS', texmfos)
65 setenv('TEXMFCNF', resolvers.luacnfspec,true)
66 setenv('PATH', newpath .. io.pathseparator .. getenv('PATH'))
67
68 report_tds("changing from root %a to %a",oldroot,newroot)
69 report_tds("prepending %a to PATH",newpath)
70 report_tds("setting TEXMFCNF to %a",resolvers.luacnfspec)
71 report_tds()
72 end
73end
74 |