*** empty log message ***

This commit is contained in:
Arvid Norberg 2004-03-07 09:58:44 +00:00
parent 37e4f1f4ad
commit 1cdfc9ce95
2 changed files with 16 additions and 4 deletions

View File

@ -97,6 +97,8 @@ namespace libtorrent
void add_tracker(std::string const& url, int tier = 0); void add_tracker(std::string const& url, int tier = 0);
void add_file(boost::filesystem::path file, size_type size); void add_file(boost::filesystem::path file, size_type size);
// TODO: set name
typedef std::vector<file_entry>::const_iterator file_iterator; typedef std::vector<file_entry>::const_iterator file_iterator;
typedef std::vector<file_entry>::const_reverse_iterator reverse_file_iterator; typedef std::vector<file_entry>::const_reverse_iterator reverse_file_iterator;

View File

@ -113,6 +113,16 @@ namespace
log.flush(); log.flush();
} }
boost::filesystem::path get_filename(
libtorrent::torrent_info const& t
, boost::filesystem::path const& p)
{
assert(t.num_files() > 0);
if (t.num_files() == 1)
return p;
else
return t.name() / p;
}
} }
namespace libtorrent namespace libtorrent
@ -130,7 +140,7 @@ namespace libtorrent
size_type file_size; size_type file_size;
try try
{ {
file f(p / t.name() / i->path, file::in); file f(p / get_filename(t, i->path), file::in);
f.seek(0, file::end); f.seek(0, file::end);
file_size = f.tell(); file_size = f.tell();
} }
@ -158,7 +168,7 @@ namespace libtorrent
size_type file_size; size_type file_size;
try try
{ {
file f(p / t.name() / i->path, file::in); file f(p / get_filename(t, i->path), file::in);
f.seek(0, file::end); f.seek(0, file::end);
file_size = f.tell(); file_size = f.tell();
} }
@ -297,7 +307,7 @@ namespace libtorrent
} }
file in( file in(
m_pimpl->save_path / m_pimpl->info.name() / file_iter->path m_pimpl->save_path / get_filename(m_pimpl->info, file_iter->path)
, file::in); , file::in);
assert(file_offset < file_iter->size); assert(file_offset < file_iter->size);
@ -391,7 +401,7 @@ namespace libtorrent
++file_iter; ++file_iter;
} }
fs::path path(m_pimpl->save_path / m_pimpl->info.name() / file_iter->path); fs::path path(m_pimpl->save_path / get_filename(m_pimpl->info, file_iter->path));
file out(path, file::out); file out(path, file::out);
assert(file_offset < file_iter->size); assert(file_offset < file_iter->size);