On Aug 25, 2011, at 9:27 PM, Ken Wesson wrote:

> On Thu, Aug 25, 2011 at 6:49 PM, Lee Spector <lspec...@hampshire.edu> wrote:
>> While slurp and spit are beautifully elegant it's not so elegant to tell 
>> slurp how to find the file you want it to slurp. In many other 
>> languages/environments there's a concept of the working directory or project 
>> directory, relative to which you can specify locations. In Clojure you have 
>> to deal with the classpath, outside of the language proper, and many of the 
>> common ways of running Clojure programs handle this differently. I don't 
>> know if there's a good, general solution to this, but for me (both as a 
>> programmer and especially as a teacher) it is definitely a pain point.
> 
> What about (System/getProperty "user.dir")?

The value of user.dir depends on how the code is run. Now that I check I see 
that if I run a lein repl in a project directory then it is set to that 
directory, which is great. But if I run the code in some other way it may be 
set to something different. For example, in clooj currently it's set to my 
Downloads directory. I'll write to the clooj list to see if this can be 
changed, but I also had problems with this sort of thing in 
Eclipse/Counterclockwise and I'm wondering: Is it specified somewhere that this 
should always be set to the project directory? If I run a lein repl from a 
non-project directory then it's set to my home directory, which makes some 
sense I guess, but why not the directory from which the repl was launched?

FWIW my larger point was just that all of this is less clear than it is in many 
other languages, and that simple file I/O is therefore less simple than one 
might hope.

Thanks,

 -Lee

-- 
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
Note that posts from new members are moderated - please be patient with your 
first post.
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