replaced boost.filesystem with custom functions (improves efficiency and drops unnecessary dependencies and improves libtorrent portability)

This commit is contained in:
Arvid Norberg
2009-10-26 01:29:39 +00:00
parent 4412e2f1f6
commit c418165e07
60 changed files with 1555 additions and 1273 deletions

View File

@@ -37,20 +37,18 @@ POSSIBILITY OF SUCH DAMAGE.
#include "libtorrent/storage.hpp"
#include "libtorrent/hasher.hpp"
#include "libtorrent/create_torrent.hpp"
#include "libtorrent/file.hpp"
#include <boost/filesystem/operations.hpp>
#include <boost/filesystem/path.hpp>
#include <boost/bind.hpp>
using namespace boost::filesystem;
using namespace libtorrent;
// do not include files and folders whose
// name starts with a .
bool file_filter(boost::filesystem::path const& filename)
bool file_filter(std::string const& f)
{
if (filename.leaf()[0] == '.') return false;
fprintf(stderr, "%s\n", filename.string().c_str());
if (filename(f)[0] == '.') return false;
fprintf(stderr, "%s\n", f.c_str());
return true;
}
@@ -82,7 +80,6 @@ void print_usage()
int main(int argc, char* argv[])
{
using namespace libtorrent;
using namespace boost::filesystem;
char const* creator_str = "libtorrent";
@@ -140,7 +137,7 @@ int main(int argc, char* argv[])
file_storage fs;
file_pool fp;
path full_path = complete(path(argv[1]));
std::string full_path = libtorrent::complete(argv[1]);
add_files(fs, full_path, file_filter);
@@ -154,7 +151,7 @@ int main(int argc, char* argv[])
t.add_url_seed(*i);
error_code ec;
set_piece_hashes(t, full_path.branch_path()
set_piece_hashes(t, parent_path(full_path)
, boost::bind(&print_progress, _1, t.num_pieces()), ec);
if (ec)
{