fix deleting of subfolders

This commit is contained in:
Marcos Pinto 2007-10-21 00:51:13 +00:00
parent 0b4b409a53
commit f2c036650c

View File

@ -485,11 +485,12 @@ namespace libtorrent
{ {
std::string p = (m_save_path / i->path).string(); std::string p = (m_save_path / i->path).string();
fs::path bp = i->path.branch_path(); fs::path bp = i->path.branch_path();
std::pair<iter_t, bool> ret = directories.insert(bp.string()); std::pair<iter_t, bool> ret;
ret.second = true;
while (ret.second && !bp.empty()) while (ret.second && !bp.empty())
{ {
std::pair<iter_t, bool> ret = directories.insert((m_save_path / bp).string());
bp = bp.branch_path(); bp = bp.branch_path();
std::pair<iter_t, bool> ret = directories.insert(bp.string());
} }
std::remove(p.c_str()); std::remove(p.c_str());
} }
@ -498,9 +499,6 @@ namespace libtorrent
// subdirectories first // subdirectories first
std::for_each(directories.rbegin(), directories.rend() std::for_each(directories.rbegin(), directories.rend()
, bind((int(*)(char const*))&std::remove, bind(&std::string::c_str, _1))); , bind((int(*)(char const*))&std::remove, bind(&std::string::c_str, _1)));
std::string p = (m_save_path / m_info->name()).string();
std::remove(p.c_str());
} }
void storage::write_resume_data(entry& rd) const void storage::write_resume_data(entry& rd) const