summaryrefslogtreecommitdiff
path: root/tex/context/base/lpdf-wid.lua
diff options
context:
space:
mode:
authorMarius <mariausol@gmail.com>2011-04-04 00:00:13 +0300
committerMarius <mariausol@gmail.com>2011-04-04 00:00:13 +0300
commit7c7fe9c9e18355f42d0dba1b248235252728060b (patch)
tree85727a23da1bc3723b55446a4c6e0f7e42f9614e /tex/context/base/lpdf-wid.lua
parent2d5753754d6f3b4641fc33e1691aa7195012d412 (diff)
downloadcontext-7c7fe9c9e18355f42d0dba1b248235252728060b.tar.gz
beta 2011.04.03 22:32
Diffstat (limited to 'tex/context/base/lpdf-wid.lua')
-rw-r--r--tex/context/base/lpdf-wid.lua21
1 files changed, 15 insertions, 6 deletions
diff --git a/tex/context/base/lpdf-wid.lua b/tex/context/base/lpdf-wid.lua
index 48beacfd8..d986e96f6 100644
--- a/tex/context/base/lpdf-wid.lua
+++ b/tex/context/base/lpdf-wid.lua
@@ -228,9 +228,14 @@ function codeinjections.embedfile(specification)
return nil
elseif r then
return r
- elseif not lfs.isfile(filename) then
- filestreams[filename] = false
- return nil
+ else
+ local foundname = resolvers.findbinfile(filename) or ""
+ if foundname == "" or not lfs.isfile(foundname) then
+ filestreams[filename] = false
+ return nil
+ else
+ specification.foundname = foundname
+ end
end
end
local basename = file.basename(filename)
@@ -241,7 +246,8 @@ function codeinjections.embedfile(specification)
f = pdfimmediateobject("stream",data,a())
specification.data = true -- signal that still data but already flushed
else
- f = pdfimmediateobject("streamfile",filename,a())
+ local foundname = specification.foundname or filename
+ f = pdfimmediateobject("streamfile",foundname,a())
end
local d = pdfdictionary {
Type = pdfconstant("Filespec"),
@@ -268,9 +274,12 @@ function nodeinjections.attachfile(specification)
filename = registered
specification.file = registered
end
- if not lfs.isfile(filename) then
+ local foundname = resolvers.findbinfile(filename) or ""
+ if foundname == "" or not lfs.isfile(foundname) then
report_attachment("invalid file specification: registered '%s', filename '%s'",registered,filename)
- return
+ return nil
+ else
+ specification.foundname = foundname
end
hash = filename
end