From ba9a57343987f1c2c72396e7c38f1fa30352c24c Mon Sep 17 00:00:00 2001 From: Mojca Miklavec Date: Mon, 5 May 2014 20:29:55 +0000 Subject: ConTeXt 2014.04.28 23:24 git-svn-id: svn://tug.org/texlive/trunk@33856 c570f23f-e606-0410-a88d-b1316a301751 --- Master/texmf-dist/tex/context/base/data-tmp.lua | 26 +++++++++++++++++++++++++ 1 file changed, 26 insertions(+) (limited to 'Master/texmf-dist/tex/context/base/data-tmp.lua') 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) -- cgit v1.2.3