mirror of
https://github.com/rakshasa/rtorrent.git
synced 2026-08-10 04:02:30 +00:00
Loads correctly formated torrents from session dir when starting.
git-svn-id: svn://rakshasa.no/libtorrent/trunk/rtorrent@294 e378c898-3ddf-0310-93e7-cc216c733640
This commit is contained in:
+12
-1
@@ -5,6 +5,7 @@
|
||||
#include <stdexcept>
|
||||
#include <dirent.h>
|
||||
|
||||
#include "functional.h"
|
||||
#include "directory.h"
|
||||
|
||||
namespace utils {
|
||||
@@ -28,7 +29,17 @@ Directory::update() {
|
||||
Base::push_back(ent->d_name);
|
||||
}
|
||||
|
||||
std::sort(begin(), end(), std::less<std::string>());
|
||||
Base::sort(std::less<std::string>());
|
||||
}
|
||||
|
||||
Directory::Base
|
||||
Directory::make_list() {
|
||||
Base l;
|
||||
|
||||
for (Base::iterator itr = begin(); itr != end(); ++itr)
|
||||
l.push_back(m_path + *itr);
|
||||
|
||||
return l;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -2,13 +2,13 @@
|
||||
#define RTORRENT_UTILS_DIRECTORY_H
|
||||
|
||||
#include <string>
|
||||
#include <vector>
|
||||
#include <list>
|
||||
|
||||
namespace utils {
|
||||
|
||||
class Directory : private std::vector<std::string> {
|
||||
class Directory : private std::list<std::string> {
|
||||
public:
|
||||
typedef std::vector<std::string> Base;
|
||||
typedef std::list<std::string> Base;
|
||||
|
||||
using Base::iterator;
|
||||
using Base::const_iterator;
|
||||
@@ -23,6 +23,8 @@ public:
|
||||
using Base::empty;
|
||||
using Base::size;
|
||||
|
||||
using Base::erase;
|
||||
|
||||
Directory() {}
|
||||
Directory(const std::string& path) : m_path(path) {}
|
||||
|
||||
@@ -30,6 +32,9 @@ public:
|
||||
|
||||
const std::string& get_path() { return m_path; }
|
||||
|
||||
// Make a list with full path names.
|
||||
Base make_list();
|
||||
|
||||
private:
|
||||
std::string m_path;
|
||||
};
|
||||
|
||||
@@ -52,9 +52,9 @@ equal(Type t, Ftor f) {
|
||||
return _equal<Type, Ftor>(t, f);
|
||||
}
|
||||
|
||||
template <typename Dest, typename Src>
|
||||
template <typename Src, typename Dest>
|
||||
struct _on : public std::unary_function<typename Src::argument_type, typename Dest::result_type> {
|
||||
_on(Dest d, Src s) : m_dest(d), m_src(s) {}
|
||||
_on(Src s, Dest d) : m_dest(d), m_src(s) {}
|
||||
|
||||
typename Dest::result_type operator () (typename Src::argument_type arg) {
|
||||
return m_dest(m_src(arg));
|
||||
@@ -64,10 +64,10 @@ struct _on : public std::unary_function<typename Src::argument_type, typename De
|
||||
Src m_src;
|
||||
};
|
||||
|
||||
template <typename Dest, typename Src>
|
||||
inline _on<Dest, Src>
|
||||
on(Dest d, Src s) {
|
||||
return _on<Dest, Src>(d, s);
|
||||
template <typename Src, typename Dest>
|
||||
inline _on<Src, Dest>
|
||||
on(Src s, Dest d) {
|
||||
return _on<Src, Dest>(s, d);
|
||||
}
|
||||
|
||||
template <typename Cond, typename Then>
|
||||
|
||||
Reference in New Issue
Block a user