summaryrefslogtreecommitdiff
path: root/src/resources
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/resources
parent2da65e2e57b664cc45c164f08ddae3597e51fcba (diff)
downloadmana-9eed8feb838c31368dba6cd9716f67d800bf6e3b.tar.gz
mana-9eed8feb838c31368dba6cd9716f67d800bf6e3b.tar.bz2
mana-9eed8feb838c31368dba6cd9716f67d800bf6e3b.tar.xz
mana-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/resources')
-rw-r--r--src/resources/resourcemanager.cpp7
-rw-r--r--src/resources/resourcemanager.h5
2 files changed, 12 insertions, 0 deletions
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.