]> Dogcows Code - chaz/yoink/blobdiff - src/Animation.cc
bugfix: resource file searching was broken
[chaz/yoink] / src / Animation.cc
index 2a3d03a5922e62a6ef68e4cf106dd3a0e8c1c99b..6df85562b7252505229c22838ae9beda7fbdbbda 100644 (file)
@@ -12,6 +12,7 @@
 #include <map>
 #include <vector>
 
+#include <Moof/Error.hh>
 #include <Moof/Manager.hh>
 #include <Moof/Log.hh>
 #include <Moof/Script.hh>
@@ -151,13 +152,18 @@ public:
                void init(const std::string& name)
                {
                        Mf::Script script;
-                       std::string filePath = Animation::getPath(name);
+                       std::string path(name);
+                       
+                       if (!Animation::getPath(path))
+                       {
+                               Mf::Error(Mf::Error::RESOURCE_NOT_FOUND).raise();
+                       }
 
                        script.importBaseLibrary();
                        importLogFunctions(script);
                        importAnimationBindings(script);
 
-                       if (script.doFile(filePath) != Mf::Script::SUCCESS)
+                       if (script.doFile(path) != Mf::Script::SUCCESS)
                        {
                                std::string str;
                                script[-1].get(str);
@@ -322,8 +328,8 @@ unsigned Animation::getFrame() const
  * the "animations" subdirectory of any of the search directories.
  */
 
-std::string Animation::getPath(const std::string& name)
+bool Animation::getPath(std::string& name)
 {
-       return Mf::Resource::getPath("animations/" + name + ".lua");
+       return Mf::Resource::getPath(name, "animations/", "lua");
 }
 
This page took 0.022263 seconds and 4 git commands to generate.