Path of Home directory

M

Martin Ankerl

I am writing a ruby application (http://speedreader.rubyforge.org/),
where I would like to store some user information to something like
~/.speedreader, and a similar path in windows. I know that in Linux I
can get this path with

Dir.chdir
homewd = Dir.pwd

Does this work in windows too? I have currently no access to a windows
machine.

Martin
 
F

Florian Gross

Martin said:
I know that in Linux I
can get this path with

Dir.chdir
homewd = Dir.pwd

Does this work in windows too? I have currently no access to a windows
machine.

Based on my test on Windows XP, yes.

But you might want to use the following instead:

home_dir = File.expand_path("~")

Regards,
Florian Gross
 
B

Brian Palmer

Florian said:
Based on my test on Windows XP, yes.

But you might want to use the following instead:

home_dir = File.expand_path("~")

Regards,
Florian Gross

Neither work on my XP Pro machine, HOME isn't a defined environment
variable, though HOME_PATH is, if that means anything.

-- Brian Palmer
 
F

Florian Gross

Brian said:
Neither work on my XP Pro machine, HOME isn't a defined environment
variable, though HOME_PATH is, if that means anything.

I have HOME, USERPROFILE and HOMEDRIVE + HOMEPATH. Ruby seems to be
depending on HOME in those code samples. I propose that it should
fallback to USERPROFILE and HOMEDRIVE + HOMEPATH (at least on Win32).

Regards,
Florian Gross
 
N

nobu.nokada

Hi,

At Wed, 18 Aug 2004 11:00:56 +0900,
Florian Gross wrote in [ruby-talk:109611]:
I have HOME, USERPROFILE and HOMEDRIVE + HOMEPATH. Ruby seems to be
depending on HOME in those code samples. I propose that it should
fallback to USERPROFILE and HOMEDRIVE + HOMEPATH (at least on Win32).

Now modified in CVS HEAD.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,744
Messages
2,569,484
Members
44,903
Latest member
orderPeak8CBDGummies

Latest Threads

Top