The idiomatic way may be to include the file(s) in the classpath and
there is already a `resource` function in clojure.java.io that can
load it from the classpath:

$ lein new foo
$ cd foo
$ mkdir resources
$ cat>resources/test.txt
hello
world
foo
bar
^D
$ # edit src/foo/core.clj as follows
(ns foo.core
  (:require [clojure.java.io :as jio]))

(println (slurp (jio/resource "test.txt")))

$ lein deps
$ lein repl
user=> (require 'foo.core)
hello
world
foo
bar
user=>

Regards,
Shantanu

On Jun 29, 5:02 am, stu <[email protected]> wrote:
> On Jun 29, 12:17 pm, "Stephen C. Gilardi" <[email protected]> wrote:
>
> > > I'd like to bundle a collection of (JSON) datafiles with a Clojure
> > > project source tree so that Clojure functions can reliably find and
> > > open those datafiles.
>
> > > What's the idiomatic way of going about this?
>
>    Many thanks to Dave and Stephen for your answers--just what I
> needed.
>
> Stu

-- 
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to [email protected]
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en

Reply via email to