I'm not sure anymore what your goal is exactly, but here is what I meant to
be complete:

(defn -main "I don't do a whole lot ... yet." [& args] (->> "hi.txt"
io/resource slurp (spit "out.txt")))

On Wed, Jan 28, 2015 at 4:57 PM, Dan Harbin <[email protected]> wrote:

> Marshall,
>
> If I remove io/file, I get:
>
> Exception in thread "main" java.lang.IllegalArgumentException: No method
> in multimethod 'do-copy' for dispatch value: [java.net.URL
> java.io.OutputStreamWriter]
>         at clojure.lang.MultiFn.getFn(MultiFn.java:160)
>         at clojure.lang.MultiFn.invoke(MultiFn.java:236)
>         at clojure.java.io$copy.doInvoke(io.clj:396)
>         at clojure.lang.RestFn.invoke(RestFn.java:425)
>         at halp.core$_main.doInvoke(core.clj:10)
>         at clojure.lang.RestFn.invoke(RestFn.java:397)
>         at clojure.lang.AFn.applyToHelper(AFn.java:152)
>         at clojure.lang.RestFn.applyTo(RestFn.java:132)
>         at halp.core.main(Unknown Source)
>
>
> It doesn't look like io/copy works with a URL.
>
> On Tuesday, January 27, 2015 at 2:52:00 PM UTC-6, Marshall
> Bockrath-Vandegrift wrote:
>>
>> On Monday, January 26, 2015 at 9:24:28 PM UTC-5, Dan Harbin wrote:
>>>
>>>
>>>       io/file
>>>
>>>
>> Just delete that line.  The `io/resource` function returns a URL which
>> all the Clojure IO functions can handle just fine-as is.  When running in
>> development the URL happens to be a `file://` URL, and thus something
>> `io/file` can handle.  Once the resource is in a JAR that is no longer the
>> case, and hence exceptions.  Just don't require a file when any URL will do
>> and you'll be fine.
>>
>> -Marshall
>>
>  --
> 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
> ---
> You received this message because you are subscribed to the Google Groups
> "Clojure" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to [email protected].
> For more options, visit https://groups.google.com/d/optout.
>

-- 
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
--- 
You received this message because you are subscribed to the Google Groups 
"Clojure" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to