[racket] How `scribble` resolves relative paths

From: Matthew Butterick (mb at mbtype.com)
Date: Mon Sep 1 21:20:05 EDT 2014

I am confused by this statement in the docs vs. the actual behavior:

The docs for `image` say that "If path is a relative path, it is relative to the current directory, which is set by `raco setup` and `scribble` to the directory of the main document file." (I'm using `image` as an example but I've seen the same problem with CSS files.)

Suppose I have a project set up like this:

/project
    /scribblings
        main.scrbl
        sample.gif

And "main.scrbl" contains this:

#lang scribble/manual
@image["sample.gif"] 

If I do this:
> cd project
> cd scribblings
> scribble main.html

The HTML will render fine.

But if I do this:

> cd project
> scribble --dest-name doc scribblings/main.scrbl

I'll get this error:

open-input-file: cannot open input file
  path: /project/sample.gif

Thus, the relative path "sample.gif" is being resolved relative to the directory where I invoke the `scribble` command, not the "directory of the main document file", which in both cases seems like it should be  /project/scribblings (i.e., the directory containing "main.scrbl").

What am I misunderstanding?






[1] http://docs.racket-lang.org/scribble/base.html?q=image#%28def._%28%28lib._scribble%2Fbase..rkt%29._image%29%29
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.racket-lang.org/users/archive/attachments/20140901/0edb3c2a/attachment.html>

Posted on the users mailing list.