Show
Ignore:
Timestamp:
12/23/07 14:12:23 (4 years ago)
Author:
rakshasa
Message:

* Refactoring utils::Directory.

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • trunk/rtorrent/src/core/download_store.cc

    r938 r1022  
    5151#include <torrent/resume.h> 
    5252#include <torrent/object_stream.h> 
     53 
     54#include "utils/directory.h" 
    5355 
    5456#include "download.h" 
     
    145147} 
    146148 
     149// This also needs to check that it isn't a directory. 
     150bool 
     151not_correct_format(const utils::directory_entry& entry) { 
     152  return !DownloadStore::is_correct_format(entry.d_name); 
     153} 
     154 
    147155utils::Directory 
    148156DownloadStore::get_formated_entries() { 
     
    150158    return utils::Directory(); 
    151159 
    152   utils::Directory d(m_path); 
     160  utils::Directory d; 
     161  d.set_path(m_path); 
    153162 
    154163  if (!d.update()) 
    155164    throw torrent::storage_error("core::DownloadStore::update() could not open directory \"" + m_path + "\""); 
    156165 
    157   d.erase(std::remove_if(d.begin(), d.end(), std::not1(std::ptr_fun(&DownloadStore::is_correct_format))), d.end()); 
     166  d.erase(std::remove_if(d.begin(), d.end(), std::ptr_fun(&not_correct_format)), d.end()); 
    158167 
    159168  return d; 
     
    161170 
    162171bool 
    163 DownloadStore::is_correct_format(std::string f) { 
     172DownloadStore::is_correct_format(const std::string& f) { 
    164173  if (f.size() != 48 || f.substr(40) != ".torrent") 
    165174    return false;