[racket] How to get current directory in the module file?

From: Jon Rafkind (rafkind at cs.utah.edu)
Date: Fri Dec 14 03:00:25 EST 2012

In a.rkt:

#lang racket
(require racket/runtime-path)
(define-runtime-path cwd ".")
(provide cwd)

On 12/14/2012 12:55 AM, Haiwei Zhou wrote:
> Hi,
>
> For example, I have two module a and other-directory/b
>
> a.rkt
> ----- begin of file ---
>
> #lang racket
>
> (define cwd (current-directory))
>
> (provide cwd)
>
> ------- end of file ----
>
> other-directory/b.rkt
> ---- begin ---
> #lang racket
>
> (require "a.rkt)
>
> (print cwd)
> ---- end ---
>
> To execute racket b.rkt, it will print "other-directory" instead of the directory of a.rkt.
>
> How to get the directory of a.rkt?
>
>
> Thanks,
> Haiwei
>
>
> ____________________
>   Racket Users list:
>   http://lists.racket-lang.org/users

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.racket-lang.org/users/archive/attachments/20121214/6897b3ec/attachment-0001.html>

Posted on the users mailing list.