Fixes #1154. Pathname.new(Dir.new('dir_name')) raises a TypeError (Dir missing to_path)
Merged 1.7 and then tweaked to make to_path be a proper alias to path since it is in 1.9+