diff options
author | Elie Roux <elie.roux@telecom-bretagne.eu> | 2010-05-25 00:25:29 +0300 |
---|---|---|
committer | Elie Roux <elie.roux@telecom-bretagne.eu> | 2010-05-25 00:25:29 +0300 |
commit | f465b932dc1c539f89bdf10f27d704383ea690d9 (patch) | |
tree | 6e69ba97a70993f5b4c8fe4905371b21b9a451ac | |
parent | 8abaf143c2810fc5b8069ac1f2f82591227c7031 (diff) | |
download | luaotfload-f465b932dc1c539f89bdf10f27d704383ea690d9.tar.gz |
Reading symlinks under non-Windows platform
Patch to detect symlinks and follow them in path normalization. Reduces my database by 30 fonts. Please test (especially on Mac OSX).
-rw-r--r-- | otfl-font-nms.lua | 18 |
1 files changed, 13 insertions, 5 deletions
diff --git a/otfl-font-nms.lua b/otfl-font-nms.lua index 120d259..5064e89 100644 --- a/otfl-font-nms.lua +++ b/otfl-font-nms.lua @@ -473,17 +473,25 @@ end local function path_normalize(path) --[[ - path normalization: - - a\b\c -> a/b/c - - a/../b -> b - - /cygdrive/a/b -> a:/b + path normalization: + - a\b\c -> a/b/c + - a/../b -> b + - /cygdrive/a/b -> a:/b + - reading symlinks under non-Win32 + - using kpse.readable_file on Win32 --]] if os.type == "windows" or os.type == "msdos" or os.name == "cygwin" then + path = kpse.readable_file(path) path = path:gsub('\\', '/') path = path:lower() - -- for cygwin cases... path = path:gsub('^/cygdrive/(%a)/', '%1:/') end + if os.type ~= "windows" and os.type ~= "msdos" then + local dest = lfs.readlink(path) + if dest then + path = file.join(file.dirname(path), dest) + end + end path = file.collapse_path(path) return path end |