summaryrefslogtreecommitdiff
path: root/luaotfload-fonts.lua
diff options
context:
space:
mode:
authorElie Roux <eroux@dedibox.ebzao.info>2010-02-16 12:52:56 +0100
committerElie Roux <eroux@dedibox.ebzao.info>2010-02-16 12:52:56 +0100
commit5410ccdac2dacc9eeca49f047e1dc0f9450c7c04 (patch)
tree9daade350438da079342ef8ff1b5123e0bf07d1c /luaotfload-fonts.lua
parent3d7683e62db26eac5af7c4e1a9b3c2f4f2b99925 (diff)
downloadluaotfload-5410ccdac2dacc9eeca49f047e1dc0f9450c7c04.tar.gz
Fixing cygwin paths
Diffstat (limited to 'luaotfload-fonts.lua')
-rw-r--r--luaotfload-fonts.lua27
1 files changed, 26 insertions, 1 deletions
diff --git a/luaotfload-fonts.lua b/luaotfload-fonts.lua
index 948d743..2b61401 100644
--- a/luaotfload-fonts.lua
+++ b/luaotfload-fonts.lua
@@ -139,6 +139,31 @@ local function load_font(filename, names, texmf)
end
end
+local system = LUAROCKS_UNAME_S or io.popen("uname -s"):read("*l")
+if system then
+ if system:match("^CYGWIN") then
+ system = 'cygwin'
+ elseif system:match("^Windows") then
+ system = 'windows'
+ else
+ system = 'unix'
+ end
+else
+ system = 'unix' -- ?
+end
+log(2, "Detecting system: %s", system)
+
+local function path_normalize(path)
+ if system == "cygwin" then
+ local res = string.lower(io.popen(string.format("cygpath.exe --mixed %s", path)):read("*all"))
+ -- a very strange thing: spaces are replaced by \n and there is a trailing \n at the end
+ res = res:gsub("\n$", '')
+ res = res:gsub("\n", ' ')
+ return res
+ end
+ return path
+end
+
local function scan_dir(dirname, names, recursive, texmf)
log(2, "Scanning directory %s", dirname)
local list, found = { }, { }
@@ -185,7 +210,7 @@ local function read_fcdata(data)
line = line:gsub(": ", "")
local ext = string.lower(string.match(line,"^.+%.([^/\\]-)$"))
if ext == "otf" or ext == "ttf" or ext == "ttc" or ext == "dfont" then
- list[#list+1] = line:gsub(": ", "")
+ list[#list+1] = path_normalize(line:gsub(": ", ""))
end
end
return list