From: nobu.nokada@... Date: 2003-06-21T19:15:40+09:00 Subject: Re: File.expand_path with files beginnig with ~ (tilde) on Windoze Hi, At Wed, 18 Jun 2003 23:14:39 +0900, Grzegorz Chrupala wrote: > On Windoze, where the "~" convention is not used, in my opinion file > names starting with "~" should _not_ be treated specially. When > 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. > An alternative would be to signal an error, but silently returning > "~$foobar" doesn't make much sense. There is no reason on Windoze to > use the Unix convention and treat file names starting with "~" any > different that other files. What makes worse is the fact that many > temp files created by M$ Office applications use names starting with > "~$". 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(?=~)/, "./")) -- Nobu Nakada