Get rid of libboost-filesystem dependency if libtorrent >= v0.16.x is used

This commit is contained in:
Christophe Dumez
2011-10-25 20:56:54 +03:00
parent 1b8a2bf7c1
commit f6b7b8bd6e
7 changed files with 187 additions and 149 deletions

View File

@@ -28,11 +28,6 @@
* Contact : chris@qbittorrent.org
*/
#include <boost/filesystem/operations.hpp>
#include <boost/filesystem/path.hpp>
#include <boost/filesystem/fstream.hpp>
#include <boost/bind.hpp>
#include <libtorrent/version.hpp>
#include <libtorrent/entry.hpp>
#include <libtorrent/bencode.hpp>
@@ -47,17 +42,34 @@
#include "torrentcreatorthread.h"
#include "misc.h"
#if LIBTORRENT_VERSION_MINOR < 16
#include <boost/filesystem/operations.hpp>
#include <boost/filesystem/path.hpp>
#include <boost/filesystem/fstream.hpp>
#endif
#include <boost/bind.hpp>
using namespace libtorrent;
#if LIBTORRENT_VERSION_MINOR < 16
using namespace boost::filesystem;
#endif
// do not include files and folders whose
// name starts with a .
#if LIBTORRENT_VERSION_MINOR >= 16
bool file_filter(std::string const& f)
{
if (filename(f)[0] == '.') return false;
return true;
}
#else
bool file_filter(boost::filesystem::path const& filename)
{
if (filename.leaf()[0] == '.') return false;
std::cerr << filename << std::endl;
return true;
}
#endif
void TorrentCreatorThread::create(QString _input_path, QString _save_path, QStringList _trackers, QStringList _url_seeds, QString _comment, bool _is_private, int _piece_size)
{
@@ -70,7 +82,9 @@ void TorrentCreatorThread::create(QString _input_path, QString _save_path, QStri
comment = _comment;
is_private = _is_private;
piece_size = _piece_size;
#if LIBTORRENT_VERSION_MINOR < 16
path::default_name_check(no_check);
#endif
abort = false;
start();
}