Skip to content

Commit

Permalink
libdeng2|Folder: has() method allows a path as parameter
Browse files Browse the repository at this point in the history
  • Loading branch information
skyjake committed May 4, 2013
1 parent cc3bb06 commit 55e0ada
Showing 1 changed file with 17 additions and 3 deletions.
20 changes: 17 additions & 3 deletions doomsday/libdeng2/src/filesys/folder.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -247,6 +247,18 @@ bool Folder::has(String const &name) const
{
DENG2_GUARD(this);

// Check if we were given a path rather than just a name.
String path = name.fileNamePath();
if(!path.empty())
{
Folder *folder = tryLocate<Folder>(path);
if(folder)
{
return folder->has(name.fileName());
}
return false;
}

return (_contents.find(name.lower()) != _contents.end());
}

Expand Down Expand Up @@ -347,9 +359,11 @@ File *Folder::tryLocateFile(String const &path) const

void Folder::attach(Feed *feed)
{
DENG2_GUARD(this);

_feeds.push_back(feed);
if(feed)
{
DENG2_GUARD(this);
_feeds.push_back(feed);
}
}

Feed *Folder::detach(Feed &feed)
Expand Down

0 comments on commit 55e0ada

Please sign in to comment.