From: Simon Strandgaard Date: 2004-04-30T09:15:11+09:00 Subject: Re: File.expand_path(__FILE__) Hal Fulton wrote: > Simon Strandgaard wrote: > > No bug. > > > > > > At the last line "File.expand_path(__FILE__)" is being invoked. > > Currend dir = "/Users/ryan/tmp/" > > File name = "tmp/demo-problem.rb" > > > > When these are being concatenated it outputs > > absolut path = "/Users/ryan/tmp/tmp/demo-problem.rb" > > > > > > concat is working ok. > > expand_path doesn't simply concatenate. If it did, we could > simply do dir + name. server> ruby -e 'p File.expand_path("a/b")' "/tmp/a/b" server> ls a ls: a: No such file or directory server> > Taking a valid relative pathname and returning an invalid > absolute pathname is not useful, certainly not a feature. > > If not a bug, at least an anomaly. I think concat are the desired behavier of expand_path. For instance if you want to create a directory, you first have to make the path, before you make it. I don't have better evidence. -- Simon Strandgaard