summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPhilipp Gesang <phg42.2a@gmail.com>2013-07-02 15:01:00 +0200
committerPhilipp Gesang <phg42.2a@gmail.com>2013-07-02 15:01:00 +0200
commit4a01814961fa764fc246f8f3976ccd830c54dadf (patch)
tree60c6559fbe53b4b3d0d696076011b89050f3aea3
parente46b1ade1a0b4cabec661aa0f505efd03b9bdc5a (diff)
downloadluaotfload-4a01814961fa764fc246f8f3976ccd830c54dadf.tar.gz
restrict readable path stats to font cache
-rw-r--r--luaotfload-database.lua35
1 files changed, 25 insertions, 10 deletions
diff --git a/luaotfload-database.lua b/luaotfload-database.lua
index 4755396..39c6ab5 100644
--- a/luaotfload-database.lua
+++ b/luaotfload-database.lua
@@ -2006,7 +2006,7 @@ local collect_cache collect_cache = function (path, all, n, luanames,
return luanames, lucnames, rest, all
end
-local getfontcachepath = function ( )
+local getwritablecachepath = function ( )
--- fonts.handlers.otf doesn’t exist outside a Luatex run,
--- so we have to improvise
local writable = caches.getwritablepath ()
@@ -2018,9 +2018,23 @@ local getfontcachepath = function ( )
end
end
+local getreadablecachepaths = function ( )
+ local readables = caches.getreadablepaths ()
+ local result = { }
+ if readables then
+ for i=1, #readables do
+ local readable = readables[i] .. "/fonts"
+ if lfsisdir (readable) then
+ result[#result+1] = readable
+ end
+ end
+ end
+ return result
+end
+
--- unit -> unit
local purge_cache = function ( )
- local writable_path = getfontcachepath ()
+ local writable_path = getwritablecachepath ()
local luanames, lucnames, rest = collect_cache(writable_path)
if logs.get_loglevel() > 1 then
print_cache("writable path", writable_path, luanames, lucnames, rest)
@@ -2031,7 +2045,7 @@ end
--- unit -> unit
local erase_cache = function ( )
- local writable_path = getfontcachepath ()
+ local writable_path = getwritablecachepath ()
local luanames, lucnames, rest, all = collect_cache(writable_path)
if logs.get_loglevel() > 1 then
print_cache("writable path", writable_path, luanames, lucnames, rest)
@@ -2046,19 +2060,20 @@ end
--- unit -> unit
local show_cache = function ( )
- local readable_paths = caches.getreadablepaths()
- local writable_path = getfontcachepath ()
+ local readable_paths = getreadablecachepaths ()
+ local writable_path = getwritablecachepath ()
local luanames, lucnames, rest = collect_cache(writable_path)
- separator()
- print_cache("writable path", writable_path, luanames, lucnames, rest)
+ separator ()
+ print_cache ("writable path", writable_path,
+ luanames, lucnames, rest)
texiowrite_nl""
for i=1,#readable_paths do
local readable_path = readable_paths[i]
if readable_path ~= writable_path then
- local luanames, lucnames = collect_cache(readable_path)
- print_cache("readable path",
- readable_path,luanames,lucnames,rest)
+ local luanames, lucnames = collect_cache (readable_path)
+ print_cache ("readable path",
+ readable_path, luanames, lucnames, rest)
end
end
separator()