summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorBjörn Steinbrink <B.Steinbrink@gmx.de>2005-08-04 21:19:25 +0000
committerBjörn Steinbrink <B.Steinbrink@gmx.de>2005-08-04 21:19:25 +0000
commit9eed8feb838c31368dba6cd9716f67d800bf6e3b (patch)
treebf7c9d1963a5d8ef031c6f04ef114722e299a7f0 /src
parent2da65e2e57b664cc45c164f08ddae3597e51fcba (diff)
downloadmana-client-9eed8feb838c31368dba6cd9716f67d800bf6e3b.tar.gz
mana-client-9eed8feb838c31368dba6cd9716f67d800bf6e3b.tar.bz2
mana-client-9eed8feb838c31368dba6cd9716f67d800bf6e3b.tar.xz
mana-client-9eed8feb838c31368dba6cd9716f67d800bf6e3b.zip
Added a method to the resource mananger to determine the real path of a file in the search path. Added a first user of that function. Minor cleanup.
Diffstat (limited to 'src')
-rw-r--r--src/gui/browserbox.cpp4
-rw-r--r--src/main.cpp2
-rw-r--r--src/resources/resourcemanager.cpp7
-rw-r--r--src/resources/resourcemanager.h5
4 files changed, 16 insertions, 2 deletions
diff --git a/src/gui/browserbox.cpp b/src/gui/browserbox.cpp
index 58877b6e..52a13763 100644
--- a/src/gui/browserbox.cpp
+++ b/src/gui/browserbox.cpp
@@ -24,6 +24,7 @@
#include <guichan.hpp>
#include "../graphics.h"
#include "../main.h"
+#include "../resources/resourcemanager.h"
#include "browserbox.h"
#include "gui.h"
@@ -45,7 +46,8 @@ BrowserBox::BrowserBox(unsigned int mode):
{
if (useOpenGL) {
browserFont = new gcn::ImageFont(
- TMW_DATADIR "data/graphics/gui/browserfont.png",
+ ResourceManager::getInstance()->getRealPath(
+ "graphics/gui/browserfont.png"),
" abcdefghijklmnopqrstuvwxyz"
"ABCDEFGHIJKLMNOPQRSTUVWXYZ01234567"
"89:@!\"$%&/=?^+*#[]{}()<>_;'.,\\|-~`");
diff --git a/src/main.cpp b/src/main.cpp
index 8e068601..df03908f 100644
--- a/src/main.cpp
+++ b/src/main.cpp
@@ -170,7 +170,7 @@ void init_engine()
// Add the main data directory to our PhysicsFS search path
resman->addToSearchPath("data", true);
- resman->addToSearchPath(TMW_DATADIR "data", 1);
+ resman->addToSearchPath(TMW_DATADIR "data", true);
// Add zip files to PhysicsFS
resman->searchAndAddArchives("/", ".zip", true);
// Updates, these override other files
diff --git a/src/resources/resourcemanager.cpp b/src/resources/resourcemanager.cpp
index 82029adf..d185b99a 100644
--- a/src/resources/resourcemanager.cpp
+++ b/src/resources/resourcemanager.cpp
@@ -118,6 +118,13 @@ bool ResourceManager::isDirectory(const std::string &path)
return PHYSFS_isDirectory(path.c_str());
}
+std::string ResourceManager::getRealPath(const std::string &path)
+{
+ const char *dirSep = PHYSFS_getDirSeparator();
+
+ return std::string(PHYSFS_getRealDir(path.c_str())) + dirSep + path;
+}
+
Resource*
ResourceManager::get(const E_RESOURCE_TYPE &type, const std::string &idPath)
{
diff --git a/src/resources/resourcemanager.h b/src/resources/resourcemanager.h
index 9db8ccce..fa7d9610 100644
--- a/src/resources/resourcemanager.h
+++ b/src/resources/resourcemanager.h
@@ -96,6 +96,11 @@ class ResourceManager
bool isDirectory(const std::string &path);
/**
+ * Returns the real path to the given path in the PhysFS search path
+ */
+ std::string getRealPath(const std::string &path);
+
+ /**
* Creates a resource and adds it to the resource map. The idPath is
* converted into the appropriate path for the current operating system
* and the resource is loaded.