Building on Dave Vanderson's answer:  Most of my files seem to have
(define-runtime-path thisdir ".") at the top.

On Tue, Aug 1, 2017 at 8:45 AM, David Vanderson <david.vander...@gmail.com>
wrote:

> On 07/31/2017 10:46 PM, Alex Harsanyi wrote:
>
>> Unfortunately, `define-runtime-path` can only be used at top-level, so the
>> above code does not compile.  It works fine without the
>> `define-runtime-path',
>> I need to use it so they query files are found when the application is
>> compiled to a stand-alone executable.
>>
>> Does anyone have an idea on how `sql-query` might be defined?
>>
>
> Maybe not the best solution, but you can put define-runtime-path for the
> containing directory at the module level.  Does this work for you?
>
> #lang racket
> (require racket/runtime-path)
>
> (define-runtime-path sql-query-dir "sql-queries")
>
> (define (sql-query file-name)
>   (define path (build-path sql-query-dir file-name))
>   ;(printf (path->string path))
>   (for ((l (file->lines path)))
>        (printf l)
>        (newline)))
>
> (sql-query "test.sql")
>
>
> Thanks,
> Dave
>
>
> --
> You received this message because you are subscribed to the Google Groups
> "Racket Users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to racket-users+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.
>

-- 
You received this message because you are subscribed to the Google Groups 
"Racket Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to racket-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to