Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Silence resolveFile() #1888

Merged
merged 2 commits into from
Oct 11, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 3 additions & 6 deletions core/sile.lua
Original file line number Diff line number Diff line change
Expand Up @@ -330,10 +330,7 @@ function SILE.processFile (filename, format, options)
if SILE.masterDir and SILE.masterDir:len() >= 1 then
_G.extendSilePath(SILE.masterDir)
end
filename = SILE.resolveFile(filename)
if not filename then
SU.error("Could not find file")
end
filename = SILE.resolveFile(filename) or SU.error("Could not find file")
local mode = lfs.attributes(filename).mode
if mode ~= "file" and mode ~= "named pipe" then
SU.error(filename.." isn't a file or named pipe, it's a ".. mode .."!")
Expand Down Expand Up @@ -393,8 +390,8 @@ function SILE.resolveFile (filename, pathprefix)
local resolved, err = package.searchpath(filename, path, "/")
if resolved then
if SILE.makeDeps then SILE.makeDeps:add(resolved) end
else
SU.warn(("Unable to find file '%s': %s"):format(filename, err))
elseif SU.debugging("paths") then
SU.debug("paths", ("Unable to find file '%s': %s"):format(filename, err))
end
return resolved
end
Expand Down
8 changes: 4 additions & 4 deletions packages/bibtex/init.lua
Original file line number Diff line number Diff line change
Expand Up @@ -39,12 +39,12 @@ end)
---@diagnostic enable: undefined-global, unused-local, lowercase-global

local parseBibtex = function (fn)
fn = SILE.resolveFile(fn)
local fh,e = io.open(fn)
if e then SU.error("Error reading bibliography file "..e) end
fn = SILE.resolveFile(fn) or SU.error("Unable to resolve Bibtex file "..fn)
local fh, e = io.open(fn)
if e then SU.error("Error reading bibliography file: "..e) end
local doc = fh:read("*all")
local t = epnf.parsestring(bibtexparser, doc)
if not(t) or not(t[1]) or t.id ~= "document" then
if not t or not t[1] or t.id ~= "document" then
SU.error("Error parsing bibtex")
end
local entries = {}
Expand Down
Loading