[Seaside] referencing resource/data/foo.pdf

Avi Bryant seaside@lists.squeakfoundation.org
Thu, 18 Jul 2002 10:54:50 -0700 (PDT)


On Thu, 18 Jul 2002, Rob Whitfield wrote:

> I am generating pdf files with my seaside application.  By having a link to
> the following I could open the pdf from my browser.
>
> /seaside/apdf/resource/foo.pdf
>
> As part of an effort to better organize things I moved the generated pdf
> down one directory level to:
>
> /seaside/apdf/resource/data/foo.pdf
>
> Now I can no longer view the pdf via the link.  I get an error that the
> file is zero length (it is definitely a valid file).  Seems like seaside
> has problems accessing or delivering files below the default level.  Does
> anyone have a suggestion for getting this to work?

Rob,

my bet is that this is a file path issue - seaside will be looking for a
file named 'data/foo.pdf', which it may or may not find depending on what
system you are on (that is, there may be a 'data\foo.pdf' or
'data:foo.pdf' instead).

The method you need to change is IAApplication>>resourceAtPath:.
This is untested (since I'm on unix), but something like

resourceAtPath: pathString
  ^ self documentDirectory fileNamed:
       (pathString copyReplaceAll: '/'
              with: FileDirectory pathNameDelimiter asString)

might do the trick.

Let me know if it works.

Cheers,
Avi