storage fix
This commit is contained in:
parent
d3b4e789ad
commit
1d6d11bf0c
12
src/file.cpp
12
src/file.cpp
|
@ -474,10 +474,18 @@ namespace libtorrent
|
||||||
ec.clear();
|
ec.clear();
|
||||||
|
|
||||||
#ifdef TORRENT_WINDOWS
|
#ifdef TORRENT_WINDOWS
|
||||||
|
// windows does not allow trailing / or \ in
|
||||||
|
// the path when removing files
|
||||||
|
std::string pruned;
|
||||||
|
if (inf[inf.size() - 1] == '/'
|
||||||
|
|| inf[inf.size() - 1] == '\\')
|
||||||
|
pruned = inf.substr(0, inf.size() - 1);
|
||||||
|
else
|
||||||
|
pruned = inf;
|
||||||
#ifdef UNICODE
|
#ifdef UNICODE
|
||||||
std::wstring f = convert_to_wstring(inf);
|
std::wstring f = convert_to_wstring(pruned);
|
||||||
#else
|
#else
|
||||||
std::string f = convert_to_native(inf);
|
std::string f = convert_to_native(pruned);
|
||||||
#endif
|
#endif
|
||||||
if (DeleteFile(f.c_str()) == 0)
|
if (DeleteFile(f.c_str()) == 0)
|
||||||
{
|
{
|
||||||
|
|
|
@ -4361,7 +4361,10 @@ namespace libtorrent
|
||||||
size_type cur_payload_dl = m_statistics.last_payload_downloaded();
|
size_type cur_payload_dl = m_statistics.last_payload_downloaded();
|
||||||
size_type cur_protocol_dl = m_statistics.last_protocol_downloaded();
|
size_type cur_protocol_dl = m_statistics.last_protocol_downloaded();
|
||||||
#endif
|
#endif
|
||||||
on_receive(error, bytes_transferred);
|
{
|
||||||
|
INVARIANT_CHECK;
|
||||||
|
on_receive(error, bytes_transferred);
|
||||||
|
}
|
||||||
#ifdef TORRENT_DEBUG
|
#ifdef TORRENT_DEBUG
|
||||||
TORRENT_ASSERT(m_statistics.last_payload_downloaded() - cur_payload_dl >= 0);
|
TORRENT_ASSERT(m_statistics.last_payload_downloaded() - cur_payload_dl >= 0);
|
||||||
TORRENT_ASSERT(m_statistics.last_protocol_downloaded() - cur_protocol_dl >= 0);
|
TORRENT_ASSERT(m_statistics.last_protocol_downloaded() - cur_protocol_dl >= 0);
|
||||||
|
|
|
@ -645,7 +645,7 @@ namespace libtorrent
|
||||||
ret.second = true;
|
ret.second = true;
|
||||||
while (ret.second && !bp.empty())
|
while (ret.second && !bp.empty())
|
||||||
{
|
{
|
||||||
std::pair<iter_t, bool> ret = directories.insert(combine_path(m_save_path, bp));
|
ret = directories.insert(combine_path(m_save_path, bp));
|
||||||
bp = parent_path(bp);
|
bp = parent_path(bp);
|
||||||
}
|
}
|
||||||
delete_one_file(p);
|
delete_one_file(p);
|
||||||
|
|
Loading…
Reference in New Issue