[racket] [Racket] Making Racket find files
And if you're still left wanting to find system/user specific paths,
find-system-path has you covered
(http://docs.racket-lang.org/reference/Filesystem.html).
On 15.02.13 16:07, Sam Tobin-Hochstadt wrote:
> When you write something like this:
>
> #lang racket
> (require "myfile.rkt")
>
> and run that, it looks for "myfile.rkt" in the same directory that the
> file you are running is in.
>
> If you're running racket at a command line, like this:
>
> % racket.exe "myfile.rkt"
>
> then racket looks for "myfile.rkt" in the current directory of the command line.
>
> If you're running racket at the command line, and then using the REPL,
> like this:
>
> % racket.exe
>> (require "myfile.rkt")
> then racket again looks for "myfile.rkt" in the directory that the
> command line was in when you started racket.
>
> In the latter two cases, you can change this within Racket by setting
> the `current-directory` parameter.
>
> Racket doesn't ever look at the system path to try to find files to
> use with `require`.
>
> Hopefully that helps,
> Sam
>
> On Fri, Feb 15, 2013 at 9:55 AM, John Sampson <jrs.idx at ntlworld.com> wrote:
>> On Feb 1 I wrote:
>>
>> "I have not been able to find a succinct description how to cope with the
>> Windows directory system to make Racket find user-created files, either to
>> run them as programs or open them as data sources or destinations. Perhaps
>> there is a particular directory where they have to be for Racket to find
>> them, and this can be set as a default in some way (environment variable or
>> whatever)."
>>
>> So can Racket be made to read environment variables such as "path" in
>> Windows 7? Or does one have to write out the whole path
>> of a file? If so - forward slashes or backslashes? How many times do they
>> have to be escaped?
>>
>> Regards
>>
>> John Sampson
>>
>>
>>
>> ____________________
>> Racket Users list:
>> http://lists.racket-lang.org/users
> ____________________
> Racket Users list:
> http://lists.racket-lang.org/users