summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/tex/context/base/data-tmp.lua
diff options
context:
space:
mode:
authorMojca Miklavec <mojca.miklavec@gmail.com>2014-05-05 20:29:55 +0000
committerMojca Miklavec <mojca.miklavec@gmail.com>2014-05-05 20:29:55 +0000
commitba9a57343987f1c2c72396e7c38f1fa30352c24c (patch)
tree66a8b12cdf67427ce96770fd0e9e581759aade1c /Master/texmf-dist/tex/context/base/data-tmp.lua
parent15242121b8ddf7d4a041fb3998d295dd8232e1eb (diff)
ConTeXt 2014.04.28 23:24
git-svn-id: svn://tug.org/texlive/trunk@33856 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/tex/context/base/data-tmp.lua')
-rw-r--r--Master/texmf-dist/tex/context/base/data-tmp.lua26
1 files changed, 26 insertions, 0 deletions
diff --git a/Master/texmf-dist/tex/context/base/data-tmp.lua b/Master/texmf-dist/tex/context/base/data-tmp.lua
index 5025a8a0ad8..3e109dcfe6d 100644
--- a/Master/texmf-dist/tex/context/base/data-tmp.lua
+++ b/Master/texmf-dist/tex/context/base/data-tmp.lua
@@ -250,6 +250,10 @@ end
caches.getreadablepaths = getreadablepaths
caches.getwritablepath = getwritablepath
+-- this can be tricky as we can have a pre-generated format while at the same time
+-- use e.g. a home path where we have updated file databases and so maybe we need
+-- to check first if we do have a writable one
+
function caches.getfirstreadablefile(filename,...)
local rd = getreadablepaths(...)
for i=1,#rd do
@@ -263,6 +267,28 @@ function caches.getfirstreadablefile(filename,...)
return caches.setfirstwritablefile(filename,...)
end
+-- next time we have an issue, we can test this instead:
+
+function caches.getfirstreadablefile_TEST_ME_FIRST(filename,...)
+ -- check if we have already written once
+ local fullname, path = caches.setfirstwritablefile(filename,...)
+ if is_readable(fullname) then
+ return fullname, path -- , true
+ end
+ -- otherwise search for pregenerated
+ local rd = getreadablepaths(...)
+ for i=1,#rd do
+ local path = rd[i]
+ local fullname = file.join(path,filename)
+ if is_readable(fullname) then
+ usedreadables[i] = true
+ return fullname, path -- , false
+ end
+ end
+ -- else assume new written
+ return fullname, path -- , true
+end
+
function caches.setfirstwritablefile(filename,...)
local wr = getwritablepath(...)
local fullname = file.join(wr,filename)