summaryrefslogtreecommitdiff
path: root/luaotfload-basics-gen.lua
diff options
context:
space:
mode:
authorPhilipp Gesang <phg42.2a@gmail.com>2013-05-16 09:46:38 +0200
committerPhilipp Gesang <phg42.2a@gmail.com>2013-05-16 09:46:38 +0200
commitc86cff5425abeb8f7a303af9e18ba61e9455b38e (patch)
tree10f668a9c22461a91b384d1e80e07e5575e0859f /luaotfload-basics-gen.lua
parentdeb475b99330b1dc1bcb8fe1c978d0354cea5364 (diff)
downloadluaotfload-c86cff5425abeb8f7a303af9e18ba61e9455b38e.tar.gz
sync with Context as of 2013-05-16
Diffstat (limited to 'luaotfload-basics-gen.lua')
-rw-r--r--luaotfload-basics-gen.lua33
1 files changed, 26 insertions, 7 deletions
diff --git a/luaotfload-basics-gen.lua b/luaotfload-basics-gen.lua
index 61f3910..0561778 100644
--- a/luaotfload-basics-gen.lua
+++ b/luaotfload-basics-gen.lua
@@ -11,9 +11,14 @@ if context then
os.exit()
end
-local dummyfunction = function() end
------ dummyreporter = function(c) return function(...) texio.write_nl(c .. " : " .. string.format(...)) end end
-local dummyreporter = function(c) return function(...) texio.write_nl(c .. " : " .. string.formatters(...)) end end
+local dummyfunction = function()
+end
+
+local dummyreporter = function(c)
+ return function(...)
+ (texio.reporter or texio.write_nl)(c .. " : " .. string.formatters(...))
+ end
+end
statistics = {
register = dummyfunction,
@@ -140,16 +145,24 @@ end
do
+ -- standard context tree setup
+
local cachepaths = kpse.expand_path('$TEXMFCACHE') or ""
+ -- quite like tex live or so
+
if cachepaths == "" then
cachepaths = kpse.expand_path('$TEXMFVAR')
end
+ -- this also happened to be used
+
if cachepaths == "" then
cachepaths = kpse.expand_path('$VARTEXMF')
end
+ -- and this is a last resort
+
if cachepaths == "" then
cachepaths = "."
end
@@ -157,8 +170,15 @@ do
cachepaths = string.split(cachepaths,os.type == "windows" and ";" or ":")
for i=1,#cachepaths do
- if file.is_writable(cachepaths[i]) then
- writable = file.join(cachepaths[i],"luatex-cache")
+ local cachepath = cachepaths[i]
+ if not lfs.isdir(cachepath) then
+ lfs.mkdirs(cachepath) -- needed for texlive and latex
+ if lfs.isdir(cachepath) then
+ texio.write(string.format("(created cache path: %s)",cachepath))
+ end
+ end
+ if file.is_writable(cachepath) then
+ writable = file.join(cachepath,"luatex-cache")
lfs.mkdir(writable)
writable = file.join(writable,caches.namespace)
lfs.mkdir(writable)
@@ -205,7 +225,6 @@ end
local function makefullname(path,name)
if path and path ~= "" then
- name = "temp-" .. name -- clash prevention
return file.addsuffix(file.join(path,name),"lua"), file.addsuffix(file.join(path,name),usingjit and "lub" or "luc")
end
end
@@ -290,7 +309,7 @@ function caches.compile(data,luaname,lucname)
d = table.serialize(data,true) -- slow
end
if d and d ~= "" then
- local f = io.open(lucname,'w')
+ local f = io.open(lucname,'wb')
if f then
local s = loadstring(d)
if s then