[plt-scheme] Loading at runtime

From: Robby Findler (robby at cs.uchicago.edu)
Date: Sat Oct 6 20:39:13 EDT 2007

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.