diff options
Diffstat (limited to 'support/lyluatex/lyluatex.lua')
-rw-r--r-- | support/lyluatex/lyluatex.lua | 24 |
1 files changed, 17 insertions, 7 deletions
diff --git a/support/lyluatex/lyluatex.lua b/support/lyluatex/lyluatex.lua index f947bde48a..b6188b71d6 100644 --- a/support/lyluatex/lyluatex.lua +++ b/support/lyluatex/lyluatex.lua @@ -1,8 +1,8 @@ -- luacheck: ignore ly log self luatexbase internalversion font fonts tex token kpse status ly_opts local err, warn, info, log = luatexbase.provides_module({ name = "lyluatex", - version = '1.1.1', --LYLUATEX_VERSION - date = "2022/11/07", --LYLUATEX_DATE + version = '1.1.2', --LYLUATEX_VERSION + date = "2022/12/21", --LYLUATEX_DATE description = "Module lyluatex.", author = "The Gregorio Project − (see Contributors.md)", copyright = "2015-2022 - jperon and others", @@ -105,7 +105,13 @@ end local function extract_includepaths(includepaths) includepaths = includepaths:explode(',') - local cfd = Score.currfiledir:gsub('^$', './') + + if lib.tex_engine.dist == 'MiKTeX' then + local cfd = Score.currfiledir:gsub('^$', '.\\') + else + local cfd = Score.currfiledir:gsub('^$', './') + end + table.insert(includepaths, 1, cfd) for i, path in ipairs(includepaths) do -- delete initial space (in case someone puts a space after the comma) @@ -143,8 +149,13 @@ local function locate(file, includepaths, ext) result = d..file if lfs.isfile(result) then break end end - if not lfs.isfile(result) and ext and file:match('%.[^%.]+$') ~= ext then return locate(file..ext, includepaths) end - if not lfs.isfile(result) then result = kpse.find_file(file) end + if not (result and lfs.isfile(result)) then + if ext and file:match('%.[^%.]+$') ~= ext then + return locate(file..ext, includepaths) + else + return kpse.find_file(file) + end + end return result end @@ -788,7 +799,7 @@ function Score:is_odd_page() return tex.count['c@page'] % 2 == 1 end function Score:lilypond_cmd() local input, mode = '-s -', 'w' - if self.debug then + if self.debug or lib.tex_engine.dist == 'MiKTeX' then local f = io.open(self.output..'.ly', 'w') f:write(self.complete_ly_code) f:close() @@ -806,7 +817,6 @@ function Score:lilypond_cmd() cmd = cmd..'-I "'..dir:gsub('^%./', lfs.currentdir()..'/')..'" ' end cmd = cmd..'-o "'..self.output..'" '..input - if lib.tex_engine.dist == 'MiKTeX' then cmd = '"'..cmd..'"' end debug("Command:\n"..cmd) return cmd, mode end |