#include <map>
#include <vector>
+#include <Moof/Error.hh>
#include <Moof/Manager.hh>
#include <Moof/Log.hh>
#include <Moof/Script.hh>
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);
* 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");
}