I was trying to write a line of code to get the absolute path of the working/current directory. The best I could come up with was this ugly piece of code. How would you make it better? Is there a common idiom?
Jeanne Boyarsky wrote:
Daniel: I gave you a cow for being first with the answer. And for not worrying about pointing out a moderator was missing something obvious!
Wow Jeanne, thanks for the cow!
This would be a case of you having forgotten more than I know.
Campbell Ritchie wrote:
And he beat me by two minutes
I would share the cow but it would make a mess of the Saloon
The thing to remember with the user.dir system variable is that it represents the directory from where the JVM was started, which can be anywhere on the filesystem, and it may or may not be what you're after. You definitely can't depend on it to find out the root of the application.