Forum: Ruby expand_path on windows for home dir

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
Bec38d63650c8912b6ba9b557fb953b9?d=identicon&s=25 Roger Pack (rogerdpack)
on 2009-05-28 15:38
currently on windows we've got:

>> File.expand_path '~'
=> "/Documents and Settings/Melissa.BLACKY"

shouldn't it be
>> File.expand_path '~'
=> "c:/Documents and Settings/Melissa.BLACKY"

?
-=r
666b4e17b4bb0e2d999037a25f65a7cb?d=identicon&s=25 Heesob Park (phasis)
on 2009-05-28 16:03
(Received via mailing list)
Hi,

2009/5/28 Roger Pack <rogerpack2005@gmail.com>:
> -=r
What's your Ruby version?
In my test, it works as expected:

C:\>ruby -ve 'p File.expand_path("~")'
ruby 1.9.1p0 (2009-01-30 revision 21907) [i386-mswin32]
"C:/Documents and Settings/phasis"

Regards,
Park Heesob
Bec38d63650c8912b6ba9b557fb953b9?d=identicon&s=25 Roger Pack (rogerdpack)
on 2009-05-28 16:13
> C:\>ruby -ve 'p File.expand_path("~")'
> ruby 1.9.1p0 (2009-01-30 revision 21907) [i386-mswin32]
> "C:/Documents and Settings/phasis"

Odd:

D:\dev>c:ruby -ve 'p File.expand_path("~")'
ruby 1.9.1p129 (2009-05-12 revision 23412) [i386-mingw32]
"/Documents and Settings/Melissa.BLACKY"

maybe I should try p0 again :)
My guess is it's some compiler define not set right.
-=r
Aee77dba395ece0a04c688b05b07cd63?d=identicon&s=25 Daniel Berger (djberg96)
on 2009-05-28 18:13
(Received via mailing list)
>
> Odd:
>
> D:\dev>c:ruby -ve 'p File.expand_path("~")'
> ruby 1.9.1p129 (2009-05-12 revision 23412) [i386-mingw32]
> "/Documents and Settings/Melissa.BLACKY"
>
> maybe I should try p0 again :)
> My guess is it's some compiler define not set right.

What's your ENV['HOME'], ENV['HOMEDRIVE'] and ENV['USERPROFILE'] set to?

Does it work if you try it from C:\ on the command line instead of D:\ ?
Regards,

Dan
Bec38d63650c8912b6ba9b557fb953b9?d=identicon&s=25 Roger Pack (rogerdpack)
on 2009-05-30 01:14
> What's your ENV['HOME'], ENV['HOMEDRIVE'] and ENV['USERPROFILE'] set to?

Odd.  Works great on one computer of mine and on the other (which has
HOME HOMEDRIVE AND USERPROFILE all set) it doesn't.  Any version of
ruby.
Odd.  Well I'm glad to know that by default it includes the drive
letter, which is right.  Luis if you're reading this might explain the
weird gem installation to different drives issue.
Thanks for your help all.
-=r
This topic is locked and can not be replied to.