summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--mkluatexfontdb.lua2
-rw-r--r--otfl-font-nms.lua20
2 files changed, 3 insertions, 19 deletions
diff --git a/mkluatexfontdb.lua b/mkluatexfontdb.lua
index e8ce1a5..d4782ea 100644
--- a/mkluatexfontdb.lua
+++ b/mkluatexfontdb.lua
@@ -95,7 +95,7 @@ local function do_run_fc_cache(c)
-- TODO: detect if fc-cache is available
end
local toexec = 'fc-cache'
- if fonts.system == 'windows' then
+ if os.type == 'windows' then
toexec = 'fc-cache.exe' -- TODO: to test on a non-cygwin Windows
end
log('executing %s...\n', toexec)
diff --git a/otfl-font-nms.lua b/otfl-font-nms.lua
index ba15f1c..aa958ea 100644
--- a/otfl-font-nms.lua
+++ b/otfl-font-nms.lua
@@ -277,33 +277,17 @@ local function load_font(filename, fontnames, status, newfontnames, newstatus, t
end
end
--- We need to detect the OS (especially cygwin) to convert paths.
-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
-
-fonts.system = system
-
-- path normalization:
-- - a\b\c -> a/b/c
-- - a/../b -> b
-- - /cygdrive/a/b -> a:/b
local function path_normalize(path)
- if system ~= 'unix' then
+ if os.type ~= 'unix' then
path = path:gsub('\\', '/')
path = path:lower()
end
path = file.collapse_path(path)
- if system == "cygwin" then
+ if os.name == "cygwin" then
path = path:gsub('^/cygdrive/(%a)/', '%1:/')
end
return path