From: grzegorz@... (Grzegorz Chrupala) Date: 2003-06-23T04:11:07+09:00 Subject: Re: File.expand_path with files beginnig with ~ (tilde) on Windoze nobu.nokada@softhome.net wrote in message news:<200306211015.h5LAFckR030479@sharui.nakada.kanuma.tochigi.jp>... > > current directory is "C:/", I would expect > > > > File.expand_path("~$foobar") > > > > to return "C:/~$foobar", just like > > > > File.expand_path("foobar") > > > > returns "C:/foobar" > > I don't guess it is Windows specific issue. On my Linux machine I get an error for File.expand_path("~foo") when there is no user "foo", on Windoze I get "~foo". > When you are sure that it's a real file name but not someone's > home directory, you can avoid it by prepending "./". > > File.expand_path(path.sub(/\A(?=~)/, "./")) That is useful, thanks! Cheers, -- Grzegorz