summaryrefslogtreecommitdiff
path: root/luaotfload-basics-gen.lua
diff options
context:
space:
mode:
authorPhilipp Gesang <phg42.2a@gmail.com>2013-07-14 10:14:23 +0200
committerPhilipp Gesang <phg42.2a@gmail.com>2013-07-14 10:14:23 +0200
commitddf162b67f0c057fefa7efb8c32fb0d0ac391bd1 (patch)
treed1e52a717ebd909938f4fab0ac7998eba68e10b3 /luaotfload-basics-gen.lua
parent076b6d52fa1ea261684de2117edc21af8342b752 (diff)
downloadluaotfload-ddf162b67f0c057fefa7efb8c32fb0d0ac391bd1.tar.gz
sync with Context as of 2013-07-14
Diffstat (limited to 'luaotfload-basics-gen.lua')
-rw-r--r--luaotfload-basics-gen.lua22
1 files changed, 16 insertions, 6 deletions
diff --git a/luaotfload-basics-gen.lua b/luaotfload-basics-gen.lua
index a5da2fd..26c1edc 100644
--- a/luaotfload-basics-gen.lua
+++ b/luaotfload-basics-gen.lua
@@ -149,19 +149,29 @@ do
local cachepaths = kpse.expand_var('$TEXMFCACHE') or ""
- -- quite like tex live or so
+ -- quite like tex live or so (the weird $TEXMFCACHE test seems to be needed on miktex)
- if cachepaths == "$TEXMFCACHE" then
+ if cachepaths == "" or cachepaths == "$TEXMFCACHE" then
cachepaths = kpse.expand_var('$TEXMFVAR') or ""
end
- -- this also happened to be used
+ -- this also happened to be used (the weird $TEXMFVAR test seems to be needed on miktex)
- if cachepaths == "$TEXMFVAR" then
+ if cachepaths == "" or cachepaths == "$TEXMFVAR" then
cachepaths = kpse.expand_var('$VARTEXMF') or ""
end
- -- and this is a last resort
+ -- and this is a last resort (hm, we could use TEMP or TEMPDIR)
+
+ if cachepaths == "" then
+ local fallbacks = { "TMPDIR", "TEMPDIR", "TMP", "TEMP", "HOME", "HOMEPATH" }
+ for i=1,#fallbacks do
+ cachepaths = os.getenv(fallbacks[i]) or ""
+ if cachepath ~= "" and lfs.isdir(cachepath) then
+ break
+ end
+ end
+ end
if cachepaths == "" then
cachepaths = "."
@@ -267,7 +277,7 @@ function caches.savedata(path,name,data)
local luaname, lucname = makefullname(path,name)
if luaname then
texio.write(string.format("(save: %s)",luaname))
- table.tofile(luaname,data,true,{ reduce = true })
+ table.tofile(luaname,data,true)
if lucname and type(caches.compile) == "function" then
os.remove(lucname) -- better be safe
texio.write(string.format("(save: %s)",lucname))