FolderModel::EntryVector FolderModel::_InitializeEntries() const { EntryVector result; auto tstrPath = GetPath(); FileFinder finder(tstrPath); while (finder.FindNext()) { result.push_back(make_unique<FolderEntry>( tstrPath, finder.GetFileName(), finder.IsDirectory(), finder.GetSize(), finder.GetAccessed(), finder.GetModified(), finder.GetCreated())); } return result; }
void KernelEntry::updateDatabase( const std::string& name ) { typedef std::deque< KernelEntry > EntryVector; int error = system( "touch KernelEntry_lock" ); if( error < 0 ) { throw hydrazine::Exception( "Failed to create KernelEntry_lock"); } boost::interprocess::file_lock flock( "KernelEntry_lock" ); report( "Updating databsse " << name ); flock.lock(); std::ifstream ifile( name.c_str() ); EntryVector entries; if( ifile.is_open() ) { boost::archive::text_iarchive archive( ifile ); unsigned int count; archive >> count; for( unsigned int i = 0; i < count; ++i ) { KernelEntry entry; archive >> entry; if( entry.header != header ) { entries.push_back(entry); } } }