Paul Stadig <p...@stadig.name> writes:

> I wrote these a while ago, and I'm not sure if they're still useful or not, 
> but I'll just send them along without any guarantee. I
> have used them like (__FILE__) and (__DIR__) when I wanted to get access to 
> things relative to the current file.
>
> (defmacro __FILE__ []
>   `(if *file*
>        (let [f# (ClassLoader/getSystemResource *file*)]
>          (if f#
>            (.getCanonicalPath (java.io.File. (.toURI f#)))
>            (.getCanonicalPath (java.io.File. *file*))))))

Wow, that's quite a set of hoops to jump through.

I don't think I could have figured that out on my own; thanks!

-Phil

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Clojure" group.
To post to this group, send email to clojure@googlegroups.com
To unsubscribe from this group, send email to 
clojure+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/clojure?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to