Skip to content

Commit

Permalink
libdeng2|ArchiveFeed: Prune items based on entry status info
Browse files Browse the repository at this point in the history
Implemented a @todo in ArchiveFeed.
  • Loading branch information
skyjake committed May 4, 2013
1 parent 4f0233a commit d590642
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 3 deletions.
1 change: 1 addition & 0 deletions doomsday/libdeng2/include/de/filesys/archiveentryfile.h
Expand Up @@ -46,6 +46,7 @@ class ArchiveEntryFile : public ByteArrayFile
~ArchiveEntryFile();

String describe() const;
String entryPath() const;

void clear();

Expand Down
5 changes: 5 additions & 0 deletions doomsday/libdeng2/src/filesys/archiveentryfile.cpp
Expand Up @@ -38,6 +38,11 @@ ArchiveEntryFile::~ArchiveEntryFile()
deindex();
}

String ArchiveEntryFile::entryPath() const
{
return _entryPath;
}

String ArchiveEntryFile::describe() const
{
DENG2_GUARD(this);
Expand Down
15 changes: 12 additions & 3 deletions doomsday/libdeng2/src/filesys/archivefeed.cpp
Expand Up @@ -194,10 +194,19 @@ void ArchiveFeed::populate(Folder &folder)
d->populate(folder);
}

bool ArchiveFeed::prune(File &/*file*/) const
bool ArchiveFeed::prune(File &file) const
{
/// @todo Prune based on entry status.
return true;
ArchiveEntryFile *entryFile = dynamic_cast<ArchiveEntryFile *>(&file);
if(entryFile && &entryFile->archive() == &archive())
{
if(!archive().hasEntry(entryFile->entryPath()))
return true; // It's gone...

// Prune based on entry status.
return archive().entryStatus(entryFile->entryPath()).modifiedAt !=
file.status().modifiedAt;
}
return false;
}

File *ArchiveFeed::newFile(String const &name)
Expand Down

0 comments on commit d590642

Please sign in to comment.