summaryrefslogtreecommitdiff
path: root/tex/context/base/mkiv/data-res.lua
diff options
context:
space:
mode:
Diffstat (limited to 'tex/context/base/mkiv/data-res.lua')
-rw-r--r--tex/context/base/mkiv/data-res.lua50
1 files changed, 29 insertions, 21 deletions
diff --git a/tex/context/base/mkiv/data-res.lua b/tex/context/base/mkiv/data-res.lua
index 831ad881c..4f171c445 100644
--- a/tex/context/base/mkiv/data-res.lua
+++ b/tex/context/base/mkiv/data-res.lua
@@ -69,12 +69,13 @@ local initializesetter = utilities.setters.initialize
local ostype, osname, osenv, ossetenv, osgetenv = os.type, os.name, os.env, os.setenv, os.getenv
-resolvers.cacheversion = "1.100"
-resolvers.configbanner = ""
-resolvers.homedir = environment.homedir
-resolvers.criticalvars = allocate { "SELFAUTOLOC", "SELFAUTODIR", "SELFAUTOPARENT", "TEXMFCNF", "TEXMF", "TEXOS" }
-resolvers.luacnfname = "texmfcnf.lua"
-resolvers.luacnfstate = "unknown"
+resolvers.cacheversion = "1.100"
+resolvers.configbanner = ""
+resolvers.homedir = environment.homedir
+resolvers.criticalvars = allocate { "SELFAUTOLOC", "SELFAUTODIR", "SELFAUTOPARENT", "TEXMFCNF", "TEXMF", "TEXOS" }
+resolvers.luacnfname = "texmfcnf.lua"
+resolvers.luacnffallback = "contextcnf.lua"
+resolvers.luacnfstate = "unknown"
-- The web2c tex binaries as well as kpse have built in paths for the configuration
-- files and there can be a depressing truckload of them. This is actually the weak
@@ -198,7 +199,6 @@ end
local dollarstripper = lpeg.stripper("$")
local inhibitstripper = P("!")^0 * Cs(P(1)^0)
-local backslashswapper = lpeg.replacer("\\","/")
local somevariable = P("$") / ""
local somekey = C(R("az","AZ","09","__","--")^1)
@@ -377,24 +377,32 @@ local function identify_configuration_files()
end
reportcriticalvariables(cnfspec)
local cnfpaths = expandedpathfromlist(resolvers.splitpath(cnfspec))
- local luacnfname = resolvers.luacnfname
- for i=1,#cnfpaths do
- local filepath = cnfpaths[i]
- local filename = collapsepath(filejoin(filepath,luacnfname))
- local realname = resolveprefix(filename) -- can still have "//" ... needs checking
- -- todo: environment.skipweirdcnfpaths directive
- if trace_locating then
- local fullpath = gsub(resolveprefix(collapsepath(filepath)),"//","/")
- local weirdpath = find(fullpath,"/texmf.+/texmf") or not find(fullpath,"/web2c",1,true)
- report_resolving("looking for %a on %s path %a from specification %a",luacnfname,weirdpath and "weird" or "given",fullpath,filepath)
- end
- if isfile(realname) then
- specification[#specification+1] = filename -- unresolved as we use it in matching, relocatable
+
+ local function locatecnf(luacnfname,kind)
+ for i=1,#cnfpaths do
+ local filepath = cnfpaths[i]
+ local filename = collapsepath(filejoin(filepath,luacnfname))
+ local realname = resolveprefix(filename) -- can still have "//" ... needs checking
+ -- todo: environment.skipweirdcnfpaths directive
if trace_locating then
- report_resolving("found configuration file %a",realname)
+ local fullpath = gsub(resolveprefix(collapsepath(filepath)),"//","/")
+ local weirdpath = find(fullpath,"/texmf.+/texmf") or not find(fullpath,"/web2c",1,true)
+ report_resolving("looking for %s %a on %s path %a from specification %a",
+ kind,luacnfname,weirdpath and "weird" or "given",fullpath,filepath)
+ end
+ if isfile(realname) then
+ specification[#specification+1] = filename -- unresolved as we use it in matching, relocatable
+ if trace_locating then
+ report_resolving("found %s configuration file %a",kind,realname)
+ end
end
end
end
+
+ locatecnf(resolvers.luacnfname,"regular")
+ if #specification == 0 then
+ locatecnf(resolvers.luacnffallback,"fallback")
+ end
if trace_locating then
report_resolving()
end