[racket-dev] A function for checking if a library path exists

From: Sam Tobin-Hochstadt (samth at cs.indiana.edu)
Date: Thu Apr 24 09:43:01 EDT 2014

Great, thanks.  I'll add a hint to the documentation pointing to
`syntax/modresolve`.

Sam

On Wed, Apr 23, 2014 at 6:31 PM, Matthew Flatt <mflatt at cs.utah.edu> wrote:
> I think you're looking for `resolve-module-path`.
>
> At Wed, 23 Apr 2014 17:41:19 -0400, Sam Tobin-Hochstadt wrote:
>> I'd like to have a function that takes a collection path, as can be
>> given to `lib`, and gives me back the file name.  What's the best way
>> to do this?
>>
>> It would seem like `collection-file-path` is the obvious solution, but
>> that requires me to parse `racket/list` into "racket" and "list.rkt".
>> The other alternative is, I think:
>>
>> (define (f x)
>>   (define rmp ((current-module-name-resolver) x #f #f #f))
>>   (define p (resolved-module-path-name rmp))
>>   (and (file-exists? p) p))
>>
>> Is this correct? Is there a simpler way to write it?
>>
>> Sam
>> _________________________
>>   Racket Developers list:
>>   http://lists.racket-lang.org/dev

Posted on the dev mailing list.