mirror of
https://github.com/rakshasa/rtorrent.git
synced 2026-08-14 22:22:31 +00:00
Working on sessions.
git-svn-id: svn://rakshasa.no/libtorrent/trunk/rtorrent@291 e378c898-3ddf-0310-93e7-cc216c733640
This commit is contained in:
@@ -0,0 +1,34 @@
|
||||
#include "config.h"
|
||||
|
||||
#include <algorithm>
|
||||
#include <functional>
|
||||
#include <stdexcept>
|
||||
#include <dirent.h>
|
||||
|
||||
#include "directory.h"
|
||||
|
||||
namespace utils {
|
||||
|
||||
void
|
||||
Directory::update() {
|
||||
if (m_path.empty())
|
||||
throw std::logic_error("Directory::update() tried to open an empty path");
|
||||
|
||||
DIR* d = opendir(m_path.c_str());
|
||||
|
||||
if (d == NULL)
|
||||
throw std::runtime_error("Directory::update() could not open directory");
|
||||
|
||||
struct dirent* ent;
|
||||
|
||||
while ((ent = readdir(d)) != NULL) {
|
||||
std::string de(ent->d_name);
|
||||
|
||||
if (de != "." && de != "..")
|
||||
Base::push_back(ent->d_name);
|
||||
}
|
||||
|
||||
std::sort(begin(), end(), std::less<std::string>());
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user