summaryrefslogtreecommitdiff
path: root/luaotfload-tool.lua
diff options
context:
space:
mode:
authorPhilipp Gesang <phg42.2a@gmail.com>2013-07-03 11:04:52 +0200
committerPhilipp Gesang <phg42.2a@gmail.com>2013-07-03 11:04:52 +0200
commit00fd07c628af41b0709d25fd00805385be561459 (patch)
treee946aacab408d2b2409018e9fef427c7a165a89a /luaotfload-tool.lua
parent1a42a842639df21d4738bb8ac12f146d829a9d17 (diff)
downloadluaotfload-00fd07c628af41b0709d25fd00805385be561459.tar.gz
add cache directory hint to luaotfload-tool; manage paths more consistently
Diffstat (limited to 'luaotfload-tool.lua')
-rwxr-xr-xluaotfload-tool.lua39
1 files changed, 19 insertions, 20 deletions
diff --git a/luaotfload-tool.lua b/luaotfload-tool.lua
index 392be6e..a353b37 100755
--- a/luaotfload-tool.lua
+++ b/luaotfload-tool.lua
@@ -80,9 +80,13 @@ After support for querying the database was added, the latter appeared
to be the more appropriate.
--doc]]--
-config = config or { }
-local config = config
-config.luaotfload = config.luaotfload or { }
+config = config or { }
+local config = config
+config.luaotfload = config.luaotfload or { }
+config.luaotfload.names_dir = config.luaotfload.names_dir or "names"
+config.luaotfload.cache_dir = config.luaotfload.cache_dir or "fonts"
+config.luaotfload.names_file = config.luaotfload.names_file
+ or "luaotfload-names.lua"
do -- we don’t have file.basename and the likes yet, so inline parser ftw
local slash = P"/"
@@ -109,19 +113,6 @@ config.lualibs.load_extended = false
require "lualibs"
---- prepare directories: the cache function in Luatex-Fonts
---- checks for writable directory only on startup, so everything
---- has to be laid out before we load basics-gen
-
-local cachepath = kpse.expand_var "$TEXMFVAR"
-if not lfs.isdir(cachepath) then
- dir.mkdirs(cachepath)
- if not lfs.isdir(cachepath) then
- texiowrite_nl(stringformat(
- "ERROR could not create directory %s", cachepath))
- end
-end
-
--[[doc--
\fileent{luatex-basics-gen.lua} calls functions from the
\luafunction{texio.*} library; too much for our taste.
@@ -144,8 +135,11 @@ local names = fonts.names
local sanitize_string = names.sanitize_string
-local db_src_out = names.path.dir.."/"..names.path.basename
-local db_bin_out = file.replacesuffix(db_src_out, "luc")
+--local db_src_out = names.path.dir.."/"..names.path.basename
+local names_plain = file.join
+ (caches.getwritablepath (config.luaotfload.names_dir),
+ config.luaotfload.names_file)
+local names_bin = file.replacesuffix (names_plain, "luc")
local help_messages = {
["luaotfload-tool"] = [[
@@ -205,6 +199,9 @@ The font database will be saved to
--cache=<directive> operate on font cache, where <directive> is
“show”, “purge”, or “erase”
+The font cache will be written to
+ %s
+
]],
mkluatexfontdb = [[
@@ -235,8 +232,10 @@ local help_msg = function ( )
or help_messages["luaotfload-tool"]
texiowrite_nl(stringformat(template,
config.luaotfload.self,
- db_src_out,
- db_bin_out))
+ names_plain,
+ names_bin,
+ caches.getwritablepath
+ (config.luaotfload.cache_dir)))
end
local version_msg = function ( )