Hi --

On Sat, 12 Jan 2002, Massimiliano Mirra wrote:

> On Fri, Jan 11, 2002 at 11:44:20PM +0900, Ron Jeffries wrote:
> >    def filesUnderManagement
> >       names = (Dir.entries(@directoryName).
> >           select { | each | ! (/.bak/ =~ each) }).sort
> >       names.reject { |each| FileTest.directory?(each) }
> >    end
>
> > Have others stumbled over this as well?
> > What do you do about it?
>
> Stumbled over this in rpkg just a couple of days ago and did about the
> same, i.e.:
>
> def RPkg.extract(directory = '.')
>   Dir.chdir(directory)
>   `tar zxf #{@archive}`
> end

Which reminds me...  In Ruby 1.7.x you have the block form of Dir.chdir,
which will un-chdir at the end.  For example:

   Dir.chdir(directory) { `tar ...` }

which might come in handy.  I'm not sure whether it makes life easier or
not in Ron's case.


David

-- 
David Alan Black
home: dblack / candle.superlink.net
work: blackdav / shu.edu
Web:  http://pirate.shu.edu/~blackdav