diff --git a/include/libtorrent/file_storage.hpp b/include/libtorrent/file_storage.hpp index e9d961b1d..c99bc3e78 100644 --- a/include/libtorrent/file_storage.hpp +++ b/include/libtorrent/file_storage.hpp @@ -253,6 +253,7 @@ namespace libtorrent size_type file_base(int index) const; void set_file_base(int index, size_type off); std::string file_path(int index) const; + std::string file_name(int index) const; size_type file_size(int index) const; sha1_hash hash(internal_file_entry const& fe) const; @@ -262,6 +263,7 @@ namespace libtorrent size_type file_base(internal_file_entry const& fe) const; void set_file_base(internal_file_entry const& fe, size_type off); std::string file_path(internal_file_entry const& fe) const; + std::string file_name(internal_file_entry const& fe) const; size_type file_size(internal_file_entry const& fe) const; #if !defined TORRENT_VERBOSE_LOGGING \ diff --git a/src/file_storage.cpp b/src/file_storage.cpp index d492047b6..3ba056f50 100644 --- a/src/file_storage.cpp +++ b/src/file_storage.cpp @@ -426,6 +426,13 @@ namespace libtorrent return combine_path(m_paths[fe.path_index], fe.filename()); } + std::string file_storage::file_name(int index) const + { + TORRENT_ASSERT(index >= 0 && index < int(m_files.size())); + internal_file_entry const& fe = m_files[index]; + return fe.filename(); + } + size_type file_storage::file_size(int index) const { TORRENT_ASSERT(index >= 0 && index < int(m_files.size())); @@ -481,6 +488,11 @@ namespace libtorrent return combine_path(m_paths[fe.path_index], fe.filename()); } + std::string file_storage::file_name(internal_file_entry const& fe) const + { + return fe.filename(); + } + size_type file_storage::file_size(internal_file_entry const& fe) const { return fe.size;