]> Dogcows Code - chaz/yoink/blobdiff - src/Moof/Image.cc
bugfix: resource file searching was broken
[chaz/yoink] / src / Moof / Image.cc
index 54e9972d6264be65021286e3e2068340794527f7..2237c88bf1bb059b208907c41e48ca3bb590d12e 100644 (file)
@@ -70,13 +70,13 @@ public:
        }
 
 
-       bool init(const std::string& name, bool flipped = false)
+       void init(const std::string& name, bool flipped = false)
        {
-               std::string path = Image::getPath(name);
+               std::string path(name);
 
                logInfo << "opening image file " << path << std::endl;
-               FILE* fp = fopen(path.c_str(), "rb");
-               if (!fp) return false;
+               FILE* fp = Image::openFile(path);
+               if (!fp) return;
 
                png_byte        signature[8];
                size_t          bytesRead;
@@ -217,8 +217,6 @@ public:
                                                                pngInfo    ? &pngInfo    : 0,
                                                                pngInfoEnd ? &pngInfoEnd : 0);
                fclose(fp);
-
-               return mContext;
        }
 
 
@@ -300,19 +298,14 @@ void Image::setAsIcon() const
 }
 
 
-std::string Image::getPath(const std::string& name)
+bool Image::getPath(std::string& name)
 {
-       if (boost::find_last(name, ".png"))
-       {
-               return Resource::getPath(name);
-       }
-       else
-       {
-               std::string path("images/");
-               path += name;
-               path += ".png";
-               return Resource::getPath(path);
-       }
+       return Resource::getPath(name, "images/", "png");
+}
+
+FILE* Image::openFile(std::string& name)
+{
+       return Resource::openFile(name, "images/", "png");
 }
 
 
This page took 0.019449 seconds and 4 git commands to generate.