summaryrefslogtreecommitdiff
path: root/src/resources
diff options
context:
space:
mode:
Diffstat (limited to 'src/resources')
-rw-r--r--src/resources/resourcemanager.cpp8
-rw-r--r--src/resources/resourcemanager.h4
-rw-r--r--src/resources/spritedef.cpp3
3 files changed, 11 insertions, 4 deletions
diff --git a/src/resources/resourcemanager.cpp b/src/resources/resourcemanager.cpp
index 6f91390e..fb9da9d7 100644
--- a/src/resources/resourcemanager.cpp
+++ b/src/resources/resourcemanager.cpp
@@ -144,11 +144,15 @@ ResourceManager::setWriteDir(const std::string &path)
return (bool) PHYSFS_setWriteDir(path.c_str());
}
-void
+bool
ResourceManager::addToSearchPath(const std::string &path, bool append)
{
logger->log("Adding to PhysicsFS: %s", path.c_str());
- PHYSFS_addToSearchPath(path.c_str(), append ? 1 : 0);
+ if (!PHYSFS_addToSearchPath(path.c_str(), append ? 1 : 0)) {
+ logger->log("Error: %s", PHYSFS_getLastError());
+ return false;
+ }
+ return true;
}
void
diff --git a/src/resources/resourcemanager.h b/src/resources/resourcemanager.h
index 46b17d1b..abfd629a 100644
--- a/src/resources/resourcemanager.h
+++ b/src/resources/resourcemanager.h
@@ -73,8 +73,10 @@ class ResourceManager
* Adds a directory or archive to the search path. If append is true
* then the directory is added to the end of the search path, otherwise
* it is added at the front.
+ *
+ * @return <code>true</code> on success, <code>false</code> otherwise.
*/
- void
+ bool
addToSearchPath(const std::string &path, bool append);
/**
diff --git a/src/resources/spritedef.cpp b/src/resources/spritedef.cpp
index de6f8d0b..d2e32c03 100644
--- a/src/resources/spritedef.cpp
+++ b/src/resources/spritedef.cpp
@@ -62,7 +62,8 @@ SpriteDef *SpriteDef::load(std::string const &animationFile, int variant)
char *data = (char*) resman->loadFile
(animationFile.substr(0, pos).c_str(), size);
- if (!data) return NULL;
+ if (!data && animationFile != "graphics/sprites/error.xml")
+ return load("graphics/sprites/error.xml", 0);
xmlDocPtr doc = xmlParseMemory(data, size);
free(data);