fixed bug in add_files that would fail to recurse if the path ended with a /

This commit is contained in:
Arvid Norberg 2009-10-25 21:07:14 +00:00
parent 6c137d6ef6
commit 28e9c58e3d
2 changed files with 8 additions and 8 deletions

View File

@ -90,6 +90,8 @@ release 0.14.7
* fixed incorrect error when deleting files from a torrent where
not all files have been created
* announces torrents immediately to the DHT when it's started
* fixed bug in add_files that would fail to recurse if the path
ended with a /
release 0.14.6

View File

@ -181,22 +181,20 @@ namespace libtorrent
{
using boost::filesystem::basic_path;
using boost::filesystem::basic_directory_iterator;
#if BOOST_VERSION < 103600
Str const& leaf = l.leaf();
#else
Str const& leaf = l.filename();
#endif
if (ignore_subdir(leaf)) return;
if (!pred(l)) return;
basic_path<Str, PathTraits> f(p / l);
if (is_directory(f))
{
for (basic_directory_iterator<basic_path<Str, PathTraits> > i(f), end; i != end; ++i)
{
#if BOOST_VERSION < 103600
add_files_impl(fs, p, l / i->path().leaf(), pred);
Str const& leaf = i->path().leaf();
#else
add_files_impl(fs, p, l / i->path().filename(), pred);
Str const& leaf = i->path().filename();
#endif
if (ignore_subdir(leaf)) continue;
add_files_impl(fs, p, l / leaf, pred);
}
}
else
{