Skip to content

Commit

Permalink
libcore|App: Added utility for finding files from loaded packages
Browse files Browse the repository at this point in the history
  • Loading branch information
skyjake committed Aug 14, 2014
1 parent 33b99bb commit 9818b3a
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 0 deletions.
11 changes: 11 additions & 0 deletions doomsday/libcore/include/de/core/app.h
Expand Up @@ -281,6 +281,17 @@ class DENG2_PUBLIC App : DENG2_OBSERVES(Clock, TimeChange)
*/
static PackageLoader &packageLoader();

/**
* Convenience method for finding all files matching a certain name or partial path
* from all loaded packages.
*
* @param partialPath File name or partial path.
* @param files Resulting list of found files.
*
* @return Number of files found.
*/
static int findInPackages(String const &partialPath, FS::FoundFiles &files);

/**
* Checks if an asset exists.
*
Expand Down
5 changes: 5 additions & 0 deletions doomsday/libcore/src/core/app.cpp
Expand Up @@ -728,6 +728,11 @@ PackageLoader &App::packageLoader()
return DENG2_APP->d->packageLoader;
}

int App::findInPackages(String const &partialPath, FS::FoundFiles &files)
{
return App::fileSystem().nameIndex().findPartialPathInPackageOrder(partialPath, files);
}

bool App::assetExists(String const &identifier)
{
return DENG2_APP->d->findAsset(identifier) != 0;
Expand Down

0 comments on commit 9818b3a

Please sign in to comment.