2 #include "zipios++/zipios-config.h"
4 #include "zipios++/meta-iostreams.h"
10 #include "directory.h"
22 : _entries_loaded( false ),
23 _recursive ( recursive ),
26 _filename = _filepath ;
29 if( _valid && load_now )
50 MatchPath matchpath )
const {
54 if ( matchpath != MATCH || _entries_loaded ) {
77 MatchPath matchpath ) {
81 if ( matchpath != MATCH || _entries_loaded ) {
89 string real_path( _filepath + entry_name ) ;
90 return new ifstream( real_path.c_str(), ios::in | ios::binary ) ;
95 string real_path( _filepath + entry_name ) ;
96 ifstream *ifs =
new ifstream( real_path.c_str(), ios::in | ios::binary ) ;
111 return _entries.size() ;
121 void DirectoryCollection::loadEntries()
const {
122 if( _entries_loaded )
127 _entries_loaded = true ;
131 void DirectoryCollection::load(
bool recursive,
const FilePath &subdir ) {
132 using namespace boost::filesystem ;
134 for ( dir_it it( _filepath + subdir ) ; it != dir_it() ; ++it ) {
136 if ( *it ==
"." || *it ==
".." || *it ==
"..." )
139 if ( get< is_directory >( it ) && recursive ) {
140 load( recursive, subdir + *it ) ;
142 _entries.push_back( ent =
new BasicEntry( subdir + *it,
"", _filepath ) ) ;
143 ent->setSize( get< boost::filesystem::size >( it ) ) ;