Profile-independent directory specification for NT?


(Moran, Craig M (BAH)) #1

Thanks! This works perfectly. However, Austin’s solution does not. I’d
imagine it was a misplaced quote. Is either style preferable over the
other?
Craig

···

-----Original Message-----
From: Jim Bob [mailto:none@invalid.com]
Sent: Wednesday, February 25, 2004 11:00 AM
To: ruby-talk@ruby-lang.org
Subject: Re: Profile-independent directory specification for NT?

The environment is available under the hash ENV. So, you can do
something like:
ProfilePath = ENV[“USERPROFILE”] + "\My Documents\"
basically like you said you’d do with VBA.


(Austin Ziegler) #2

I just tried my version in Windows XP with irb and it produced the exact
result.

With the version provided by Jim Bob, you get a string, create a string, and
then add them to a new string. With mine, you’re only creating one string
through.

irb(main):030:0> profile_path = “#{ENV[‘USERPROFILE’]}\My Documents\”
=> “C:\Documents and Settings\Austin\My Documents\”

-austin

···

On Thu, 26 Feb 2004 01:38:25 +0900, Moran, Craig M (BAH) wrote:

Thanks! This works perfectly. However, Austin’s solution does not. I’d
imagine it was a misplaced quote. Is either style preferable over the
other? Craig


austin ziegler * austin@halostatue.ca * Toronto, ON, Canada
software designer * pragmatic programmer * 2004.02.25
* 12.21.29