diff options
author | Philipp Gesang <phg42.2a@gmail.com> | 2014-06-09 23:16:21 +0200 |
---|---|---|
committer | Philipp Gesang <phg42.2a@gmail.com> | 2014-06-09 23:16:21 +0200 |
commit | f35290839badf0df18f46f548c24d6b493c27a90 (patch) | |
tree | bbc8e9028cbe6e1d867e9c5925433857244f3221 | |
parent | 1780d5eede861e35d05387278e90412ddac13d8f (diff) | |
download | luaotfload-f35290839badf0df18f46f548c24d6b493c27a90.tar.gz |
[conf] use actual XDG paths for configuration directories
-rw-r--r-- | src/luaotfload-configuration.lua | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/src/luaotfload-configuration.lua b/src/luaotfload-configuration.lua index c1db424..ff90f68 100644 --- a/src/luaotfload-configuration.lua +++ b/src/luaotfload-configuration.lua @@ -46,6 +46,7 @@ local lpeg = require "lpeg" local lpegmatch = lpeg.match local kpse = kpse +local kpseexpand_path = kpse.expand_path local kpselookup = kpse.lookup local lfs = lfs @@ -74,11 +75,18 @@ local getwritablepath = caches.getwritablepath local path_t = 0 local kpse_t = 1 +local val_home = kpseexpand_path "~" +local val_xdg_config_home = kpseexpand_path "$XDG_CONFIG_HOME" + +if val_xdg_config_home == "" then val_xdg_config_home = "~/.config" end + local config_paths = { --- needs adapting for those other OS + { path_t, "./luaotfload.conf" }, { path_t, "./luaotfloadrc" }, - { path_t, "~/.config/luaotfload/luaotfload.conf" }, - { path_t, "~/.luaotfloadrc" }, + { path_t, filejoin (val_xdg_config_home, "luaotfload/luaotfload.conf") }, + { path_t, filejoin (val_xdg_config_home, "luaotfload/luaotfloadrc") }, + { path_t, filejoin (val_home, ".luaotfloadrc") }, { kpse_t, "luaotfloadrc" }, { kpse_t, "luaotfload.conf" }, } |