diff options
author | Elie Roux <elie.roux@telecom-bretagne.eu> | 2013-04-21 15:17:58 +0200 |
---|---|---|
committer | Elie Roux <elie.roux@telecom-bretagne.eu> | 2013-04-21 15:17:58 +0200 |
commit | 14b3ba09e583caaa7e31ab7bfabc4871cbb206fd (patch) | |
tree | 663773940ecd44f38cac2d22cd366e5a7a880abe /otfl-font-nms.lua | |
parent | e7b982403c2c77e22a263e87b4d40bb226d61107 (diff) | |
download | luaotfload-14b3ba09e583caaa7e31ab7bfabc4871cbb206fd.tar.gz |
Using caches.* functions from ConTeXt (fixes Issue #5)
Diffstat (limited to 'otfl-font-nms.lua')
-rw-r--r-- | otfl-font-nms.lua | 18 |
1 files changed, 14 insertions, 4 deletions
diff --git a/otfl-font-nms.lua b/otfl-font-nms.lua index e8ad626..3ee6ee4 100644 --- a/otfl-font-nms.lua +++ b/otfl-font-nms.lua @@ -53,14 +53,25 @@ fonts = fonts or { } fonts.names = fonts.names or { } local names = fonts.names -local names_dir = "luatex-cache/generic/names" + names.version = 2.2 names.data = nil names.path = { basename = "otfl-names.lua", - dir = filejoin(kpse.expand_var("$TEXMFVAR"), names_dir), + dir = "", + path = "", } +-- We use the cache.* of ConTeXt (see luat-basics-gen), we can +-- use it safely (all checks and directory creations are already done). It +-- uses TEXMFCACHE or TEXMFVAR as starting points. +local writable_path = caches.getwritablepath("names","") +if not writable_path then + error("Impossible to find a suitable writeable cache...") +end +names.path.dir = writable_path +names.path.path = filejoin(writable_path, names.path.basename) + ---- <FIXME> --- @@ -161,8 +172,7 @@ local scan_external_dir local update_names load_names = function ( ) - local path = filejoin(names.path.dir, names.path.basename) - local foundname, data = load_lua_file(path) + local foundname, data = load_lua_file(names.path.path) if data then report("info", 0, "Font names database loaded", "%s", foundname) |