# $Id: dir.rb,v 1.2 2002/04/08 20:28:26 knu Exp $

require 'features/ruby18/base'

class << Dir
  alias __ruby16_chdir chdir

  def chdir(dir)
    block_given? or return Dir.__ruby16_chdir(dir)

    pwd = Dir.pwd

    begin
      Dir.__ruby16_chdir(dir)
      return yield
    ensure
      Dir.__ruby16_chdir(pwd)
    end
  end
end
