X-Git-Url: https://git.dogcows.com/gitweb?p=chaz%2Fyoink;a=blobdiff_plain;f=src%2FMoof%2FResource.cc;fp=src%2Fresource.cc;h=5efe8f53f43c4ae0ebdb98102d5870df8deb27a7;hp=16b5f213489ae39ed9448901e5f06d0b2a901160;hb=c2321281bf12a7efaedde930422c7ddbc92080d4;hpb=87bc17e55b0c1dc73ecc66df856d3f08fd7a7724 diff --git a/src/resource.cc b/src/Moof/Resource.cc similarity index 81% rename from src/resource.cc rename to src/Moof/Resource.cc index 16b5f21..5efe8f5 100644 --- a/src/resource.cc +++ b/src/Moof/Resource.cc @@ -28,19 +28,20 @@ #include -#include "resource.hh" +#include "Resource.hh" -namespace dc { +namespace Mf { -std::vector resource::searchPaths_; +// static member +std::vector Resource::searchPaths_; -resource::~resource() {} +Resource::~Resource() {} -void resource::addSearchPath(const std::string& directory) +void Resource::addSearchPath(const std::string& directory) { // add a slash if there isn't one already if (directory[directory.length() - 1] != '/') @@ -53,16 +54,16 @@ void resource::addSearchPath(const std::string& directory) } } -std::string resource::getPathToResource(const std::string& name) +std::string Resource::getPathToResource(const std::string& name) { - std::vector::iterator i; + std::vector::iterator it; - for (i = searchPaths_.begin(); i != searchPaths_.end(); i++) + for (it = searchPaths_.begin(); it != searchPaths_.end(); it++) { - std::string fullPath(*i); + std::string fullPath(*it); fullPath += name; - // TODO access(2) is not all that portable + // TODO this could be more portable if (access(fullPath.c_str(), R_OK) == 0) { return fullPath; @@ -74,7 +75,7 @@ std::string resource::getPathToResource(const std::string& name) } -} // namespace dc +} // namespace Mf /** vim: set ts=4 sw=4 tw=80: *************************************************/