--0016361e7b0c9bbe29049638d3d5
Content-Type: text/plain; charset=ISO-8859-1

On Mon, Sep 27, 2010 at 4:55 AM, Klaus Stein <usenet / istik.de> wrote:

> Josh Cheek <josh.cheek / gmail.com> wrote:
> > Hi, there is a gem I want to use (bones-extras), but the part I want to
> use
> > doesn't work on 1.9.2 since they removed "." from the path (extremely
> > irritating, btw).
> >
> > On my system, I can fix it, by editing the source to add "." to the
> > beginning of the file path, [...]
>
> You should _not_ use this fix, at least not for a public gem (as you are
> not
> only responsible for your own system). There are (security) issues with
> having the current directory in the load path and . is removed with intent.
>
> Use require_relative or something similar to fix the gem.
>
> I appreciate that you want to help the community, go on with that.
>
> Klaus
>
> --
> http://lapiz.istik.de/
>
> The Answer is 42. And I am the Answer. Now I am looking for the Question.
>
>
The gem I was going to contribute to (bones-extras) has been deprecated, so
this is no longer an issue.

But for the sake of clarity (because this has been messing with my brain for
a while), require_relative requires relative to the current file's dir, not
relative to the working dir, so this would not work. (ruby-doc doesn't have
this listed, so I was never able to find it, but it is in the 1.9 Pickaxe)

In other words require_relative is equivalent to
    require File.dirname(__FILE__)+'/file'
And what I am doing is equivalent to
    require Dir.pwd + '/file'

So require_relative is not a solution. (nevermind that I was using it in a
FileList)

In fact, I expect that this misunderstanding means there is no problem at
all, so I am going to operate on the assumption that when you want to
require things relative to the working directory, that you _should_ begin
the string with a dot. ie `require './file'` If this is not acceptable, let
me know what is the proper way to do it. And if the reasoning is not
obvious, please explain it.

--0016361e7b0c9bbe29049638d3d5--