summaryrefslogtreecommitdiff
path: root/macros/luatex/latex/pyluatex/pyluatex.lua
diff options
context:
space:
mode:
authorNorbert Preining <norbert@preining.info>2022-03-17 03:00:46 +0000
committerNorbert Preining <norbert@preining.info>2022-03-17 03:00:46 +0000
commit8208f204439f3a899e43187857e3f9c86d4ebb7c (patch)
tree70c940f6d7a58f7878aeef16a87a1af85f6f3f69 /macros/luatex/latex/pyluatex/pyluatex.lua
parent725ce6a3e602c7516d471df841ea433b8c5bcd9d (diff)
CTAN sync 202203170300
Diffstat (limited to 'macros/luatex/latex/pyluatex/pyluatex.lua')
-rw-r--r--macros/luatex/latex/pyluatex/pyluatex.lua20
1 files changed, 10 insertions, 10 deletions
diff --git a/macros/luatex/latex/pyluatex/pyluatex.lua b/macros/luatex/latex/pyluatex/pyluatex.lua
index 0b785239da..efa80c75f4 100644
--- a/macros/luatex/latex/pyluatex/pyluatex.lua
+++ b/macros/luatex/latex/pyluatex/pyluatex.lua
@@ -45,16 +45,16 @@ local env_repl_mode = false
local last_code = nil
local last_output = nil
-local function get_tex_file()
+local function get_tex_file_folder()
for k, v in ipairs(arg) do
if not v:find("^%-") then
- local path = lfs.currentdir() .. dir_sep .. v
- if lfs.attributes(path, "mode") == "file" then
- return path
+ local path = file.collapsepath(v, true)
+ if lfs.isfile(path) then
+ return file.pathpart(path)
else
- path = path .. ".tex"
- if lfs.attributes(path, "mode") == "file" then
- return path
+ path = file.addsuffix(path, "tex")
+ if lfs.isfile(path) then
+ return file.pathpart(path)
end
end
end
@@ -76,9 +76,9 @@ function pyluatex.start(executable, local_imports)
local cmd = ""
if local_imports then
- local tex_file = get_tex_file()
- if tex_file ~= nil then
- cmd = " \"" .. tex_file .. "\""
+ local tex_file_folder = get_tex_file_folder()
+ if tex_file_folder ~= nil then
+ cmd = " \"" .. tex_file_folder .. "\""
end
end
cmd = executable .. " \"" .. script .. "\"" .. cmd