1

How do we get the path to the resources directory in a lein app project?

I have one way that I've seen, this

(clojure.java.io/resource "file.txt")

The doc says "Returns the URL for a named resource" but I'm confused by this...not sure it is something I'd want to use. Suppose this case:

/project.clj
/src
/src/core.clj
/resources/A.txt
/resources/B.txt

Say file A.txt contains a sentence in lower case letters. And say that I want to read it and then write the same sentence to B.txt in upper case. How do I even tell the project to write to /resources/whatever.txt?

dirtymikeandtheboys
  • 511
  • 2
  • 5
  • 17

1 Answers1

2

If I understand this, resources are often stored within the JAR and are read-only. I don't think they are the right tool for doing this.

Arthur Ulfeldt
  • 90,827
  • 27
  • 201
  • 284
  • Oh, that makes sense. I guess I would just need a reliable way to read from resources. Just wanted to make sure I'm doing it right. – dirtymikeandtheboys Jun 27 '14 at 21:09
  • 1
    Here are the best answers I've seen to that question: http://stackoverflow.com/questions/8009829/resources-in-clojure-applications – Dave Yarwood Jun 30 '14 at 18:39