[racket] How `scribble` resolves relative paths

From: Matthew Flatt (mflatt at cs.utah.edu)
Date: Tue Sep 2 00:59:02 EDT 2014

I think the docs are wrong. While `raco setup` does set the current
directory, `scribble` does not.

It's better to use `define-runtime-path` instead of relying on the
current directory, since that composes better.

At Mon, 1 Sep 2014 18:20:05 -0700, Matthew Butterick wrote:
> 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._scribb
> le%2Fbase..rkt%29._image%29%29____________________
>   Racket Users list:
>   http://lists.racket-lang.org/users

Posted on the users mailing list.