[plt-scheme] Loading at runtime

From: Matt Jadud (jadudm at gmail.com)
Date: Sat Oct 6 20:51:18 EDT 2007

I throw the error

(error 'foo
               "Cannot find 'file.dat' in ~s"
               (current-directory))

and I get a path of <path:/>.

I think that's the notation. Either way, the point is, the executable
(Mac OSX, DrScheme 371 3m) seems to be claiming that my current
directory is '/'.

This actually needs to deploy on Windows more than anything else, but
it strikes me as odd that I don't at least get something resembling a
good path this way. The executable was created from DrScheme using
"Create Executable," built for distribution, and based on MrEd. The
executable bundle was first copied from the disk image onto the local
HD, and then executed... which is where the problem/error in finding a
path manifested itself.

Cheers,
Matt

On 10/6/07, Robby Findler <robby at cs.uchicago.edu> wrote:
> I would have thought that current-directory is what you want (which is
> the same as using a relative path), but that's not working?
>
> How did you create the executable? When you start it up, what is the
> value of (current-directory)?
>
> Robby
>
> On 10/6/07, Matt Jadud <jadudm at gmail.com> wrote:
> > Hi all,
> >
> > So I've created an executable. I want it to 'read' a datafile from the
> > same directory as the executable. I don't know where that executable
> > will end up... but I know the datafile will be in the same place.
> > (Well, I'll check to see if it is first, and if it isn't, then I'll
> > throw an error. But that's a digression.)
> >
> > Simply using 'open-input-file' with a "filename.dat" doesn't do the
> > trick. 'define-runtime-path' gives me something that (on my Mac) will
> > let me move the executable, but the datafile needs to be in the same
> > place as I developed the executable... that is, the datafile and
> > executable can't move together.
> >
> > It doesn't seem like "this-expression-source-directory" is what I want.
> >
> > How do I open a file relative to the executing program I've bundled
> > for distribution? I feel like this should be obvious, but I'm missing
> > it at the moment. No doubt, I'll find it in the Help Desk
> > momentarily...
> >
> > Cheers,
> > Matt
> > _________________________________________________
> >   For list-related administrative tasks:
> >   http://list.cs.brown.edu/mailman/listinfo/plt-scheme
> >
>


Posted on the users mailing list.