diff options
-rwxr-xr-x | luaotfload-tool.lua | 13 | ||||
-rw-r--r-- | luaotfload.dtx | 17 |
2 files changed, 30 insertions, 0 deletions
diff --git a/luaotfload-tool.lua b/luaotfload-tool.lua index 0d3b229..2c525d9 100755 --- a/luaotfload-tool.lua +++ b/luaotfload-tool.lua @@ -90,6 +90,19 @@ 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(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. diff --git a/luaotfload.dtx b/luaotfload.dtx index daaa48c..0d062a6 100644 --- a/luaotfload.dtx +++ b/luaotfload.dtx @@ -1290,6 +1290,23 @@ if tex.luatexversion < luatex_version then end % \end{macrocode} +% Prepare directories: the cache function in Luatex-Fonts checks for a +% writable directory only once during startup. If there is no +% \fileent{texmf-var} at this time it will create a subdirectory +% \fileent{./luatex-cache} instead. +% Thus everything has to be laid out before we load the fontloader. +% +% \begin{macrocode} + +local cachepath = kpse.expand_var"$TEXMFVAR" +if not lfs.isdir(cachepath) then + dir.mkdirs(cachepath) + if not lfs.isdir(cachepath) then + error( "ERROR could not create directory %s", cachepath) + end +end + +% \end{macrocode} % \subsection{Module loading} % We load the files imported from \CONTEXT with this function. % It automatically prepends the prefix \fileent{luaotfload-} to its |