diff --git a/examples/make_torrent.cpp b/examples/make_torrent.cpp index de763001f..00edacda3 100644 --- a/examples/make_torrent.cpp +++ b/examples/make_torrent.cpp @@ -158,8 +158,15 @@ int main(int argc, char* argv[]) , end(web_seeds.end()); i != end; ++i) t.add_url_seed(*i); + error_code ec; set_piece_hashes(t, full_path.branch_path() - , boost::bind(&print_progress, _1, t.num_pieces())); + , boost::bind(&print_progress, _1, t.num_pieces()), ec); + if (ec) + { + std::cerr << ec.message() << std::endl; + return 1; + } + std::cerr << std::endl; t.set_creator(creator_str); diff --git a/include/libtorrent/create_torrent.hpp b/include/libtorrent/create_torrent.hpp index 39051d3a4..2e1e08abf 100644 --- a/include/libtorrent/create_torrent.hpp +++ b/include/libtorrent/create_torrent.hpp @@ -56,6 +56,7 @@ POSSIBILITY OF SUCH DAMAGE. #include #include #include +#include #ifdef _MSC_VER #pragma warning(pop) @@ -250,6 +251,7 @@ namespace libtorrent } } +#ifndef BOOST_NO_EXCEPTIONS template void set_piece_hashes(create_torrent& t, boost::filesystem::path const& p, Fun f) { @@ -258,19 +260,18 @@ namespace libtorrent if (ec) throw libtorrent_exception(ec); } -#ifndef BOOST_NOEXCEPTIONS inline void set_piece_hashes(create_torrent& t, boost::filesystem::path const& p) { error_code ec; set_piece_hashes(t, p, detail::nop, ec); if (ec) throw libtorrent_exception(ec); } +#endif inline void set_piece_hashes(create_torrent& t, boost::filesystem::path const& p, error_code& ec) { set_piece_hashes(t, p, detail::nop, ec); } -#endif // wpath versions @@ -324,7 +325,7 @@ namespace libtorrent } } -#ifndef BOOST_NOEXCEPTIONS +#ifndef BOOST_NO_EXCEPTIONS template void set_piece_hashes(create_torrent& t, boost::filesystem::wpath const& p, Fun f) {