summaryrefslogtreecommitdiff
path: root/src/library
diff options
context:
space:
mode:
authorLaurenz <laurmaedje@gmail.com>2022-05-16 17:56:23 +0200
committerLaurenz <laurmaedje@gmail.com>2022-05-16 17:56:36 +0200
commita741bd6b83d1e374c8218b5439e26522499cc4ae (patch)
tree796ef8b8ae2186a082f37a2aa4732c9bba7d2bdf /src/library
parent6536e9e069616b862ebb774c7bef1b886c069350 (diff)
Absolute paths
Diffstat (limited to 'src/library')
-rw-r--r--src/library/graphics/image.rs12
1 files changed, 8 insertions, 4 deletions
diff --git a/src/library/graphics/image.rs b/src/library/graphics/image.rs
index ee854130..6fd465cb 100644
--- a/src/library/graphics/image.rs
+++ b/src/library/graphics/image.rs
@@ -12,11 +12,15 @@ impl ImageNode {
pub const FIT: ImageFit = ImageFit::Cover;
fn construct(ctx: &mut Context, args: &mut Args) -> TypResult<Content> {
- let path = args.expect::<Spanned<EcoString>>("path to image file")?;
- let full = ctx.complete_path(&path.v);
+ let Spanned { v: path, span } =
+ args.expect::<Spanned<EcoString>>("path to image file")?;
+
+ let full = ctx.locate(&path).at(span)?;
let id = ctx.images.load(&full).map_err(|err| match err.kind() {
- std::io::ErrorKind::NotFound => error!(path.span, "file not found"),
- _ => error!(path.span, "failed to load image ({})", err),
+ std::io::ErrorKind::NotFound => {
+ error!(span, "file not found (searched at {})", full.display())
+ }
+ _ => error!(span, "failed to load image ({})", err),
})?;
let width = args.named("width")?;