From: "Gonçalo Silva" Date: 2011-01-04T21:56:56+09:00 Subject: [ruby-core:34056] Re: Warn when File.expand_path Ignores its Second Argument? --000e0cd312f0f99e320499048e31 Content-Type: text/plain; charset=ISO-8859-1 I think it would be better if it raised a warning. I can imagine a situation where the second argument isn't supposed to ignored, just like the first one isn't supposed to be an absolute path. Silently ignoring the second argument (either in File.expand_path or URI.join) doesn't seem right to me. On Tue, Jan 4, 2011 at 00:43, Marc-Andre Lafortune < ruby-core-mailing-list@marc-andre.ca> wrote: > This is not related directly to the "~". File.expand_path ignores the > second argument completely if the first argument is any absolute path > (e.g. "/a/b", or as you mention "~/b"). > > I think this is similar to other methods (e.g. URI.join), and my > feeling is that this behavior is desirable and that no warning is > required, but the doc could probably be made more explicit, either > with an added example or a specific explanation. > > On Mon, Jan 3, 2011 at 5:57 PM, Run Paint Run Run > wrote: > > File.expand_path(filename, directory) resolves _filename_ relative to > > _directory_. If _filename_ begins with a tilde, however, it is > > expanded relative to a home directory; the _directory_ argument is > > silently ignored. Is this desirable? If not, would a patch be accepted > > to issue a warning? > > > > > > --000e0cd312f0f99e320499048e31 Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable
I think it would be better if it raised a warning. I can imagine a sit= uation where the second argument isn't supposed to ignored, just like t= he first one isn't supposed to be an absolute path. Silently ignoring t= he second argument (either in File.expand_path or URI.join) doesn't see= m right to me.


On Tue, Jan 4, 2011 at 00:43, Marc-Andre= Lafortune <ruby-core-mailing-list@marc-andre.ca> wrote:
This is not related directly to the "~= ". File.expand_path ignores the
second argument completely if the first argument is any absolute path
(e.g. "/a/b", or as you mention "~/b").

I think this is similar to other methods (e.g. URI.join), and my
feeling is that this behavior is desirable and that no warning is
required, but the doc could probably be made more explicit, either
with an added example or a specific explanation.

On Mon, Jan 3, 2011 at 5:57 PM, Run Paint Run Run <runrun@runpaint.org> wrote:
> File.expand_path(filename, directory) resolves _filename_ relative to<= br> > _directory_. If _filename_ begins with a tilde, however, it is
> expanded relative to a home directory; the _directory_ argument is
> silently ignored. Is this desirable? If not, would a patch be accepted=
> to issue a warning?
>
>


--000e0cd312f0f99e320499048e31--