diff options
Diffstat (limited to 'Swiften/Application/ApplicationPathProvider.cpp')
-rw-r--r-- | Swiften/Application/ApplicationPathProvider.cpp | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/Swiften/Application/ApplicationPathProvider.cpp b/Swiften/Application/ApplicationPathProvider.cpp index ec19160..47ef1ad 100644 --- a/Swiften/Application/ApplicationPathProvider.cpp +++ b/Swiften/Application/ApplicationPathProvider.cpp @@ -10,6 +10,7 @@ #include <iostream> #include "Swiften/Application/ApplicationPathProvider.h" +#include "Swiften/Base/foreach.h" namespace Swift { @@ -38,4 +39,15 @@ boost::filesystem::path ApplicationPathProvider::getProfileDir(const String& pro return result; } +boost::filesystem::path ApplicationPathProvider::getResourcePath(const String& resource) const { + std::vector<boost::filesystem::path> resourcePaths = getResourceDirs(); + foreach(const boost::filesystem::path& resourcePath, resourcePaths) { + boost::filesystem::path r(resourcePath / resource.getUTF8String()); + if (boost::filesystem::exists(r)) { + return r; + } + } + return boost::filesystem::path(); +} + } |