summaryrefslogtreecommitdiff
path: root/src/resources
diff options
context:
space:
mode:
authorBjørn Lindeijer <bjorn@lindeijer.nl>2006-07-18 15:52:42 +0000
committerBjørn Lindeijer <bjorn@lindeijer.nl>2006-07-18 15:52:42 +0000
commit151abcad30a0e1582b91b58b4a42343f5686979c (patch)
tree74327dc22f72763716e293f803fe2849ae397847 /src/resources
parentd6f4f362895b1b0aa3681a8255c7f996457d79cd (diff)
downloadmana-client-151abcad30a0e1582b91b58b4a42343f5686979c.tar.gz
mana-client-151abcad30a0e1582b91b58b4a42343f5686979c.tar.bz2
mana-client-151abcad30a0e1582b91b58b4a42343f5686979c.tar.xz
mana-client-151abcad30a0e1582b91b58b4a42343f5686979c.zip
Updated the updating system. It will now only load those updates
specified in the downloaded resources.txt file, and in the order in which they are mentioned (the top one being the most significant).
Diffstat (limited to 'src/resources')
-rw-r--r--src/resources/resourcemanager.cpp33
-rw-r--r--src/resources/resourcemanager.h12
2 files changed, 6 insertions, 39 deletions
diff --git a/src/resources/resourcemanager.cpp b/src/resources/resourcemanager.cpp
index 1cdf5a65..a6dc692b 100644
--- a/src/resources/resourcemanager.cpp
+++ b/src/resources/resourcemanager.cpp
@@ -72,37 +72,10 @@ ResourceManager::setWriteDir(const std::string &path)
void
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);
}
-void
-ResourceManager::searchAndAddArchives(const std::string &path,
- const std::string &ext,
- bool append)
-{
- const char *dirSep = PHYSFS_getDirSeparator();
- char **list = PHYSFS_enumerateFiles(path.c_str());
-
- for (char **i = list; *i != NULL; i++)
- {
- size_t len = strlen(*i);
-
- if (len > ext.length() && !ext.compare((*i)+(len - ext.length())))
- {
- std::string file, realPath, archive;
-
- file = path + "/" + (*i);
- realPath = std::string(PHYSFS_getRealDir(file.c_str()));
- archive = realPath + path + dirSep + (*i);
-
- logger->log("Adding to PhysicsFS: %s", archive.c_str());
- addToSearchPath(archive, append);
- }
- }
-
- PHYSFS_freeList(list);
-}
-
bool
ResourceManager::mkdir(const std::string &path)
{
@@ -289,9 +262,9 @@ ResourceManager::loadTextFile(const std::string &fileName)
}
std::istringstream iss(std::string(fileContents, contentsLength));
-
std::string line;
- while(getline(iss, line, '\n')) {
+
+ while (getline(iss, line, '\n')) {
lines.push_back(line);
}
diff --git a/src/resources/resourcemanager.h b/src/resources/resourcemanager.h
index 37fbe213..8d60ae8c 100644
--- a/src/resources/resourcemanager.h
+++ b/src/resources/resourcemanager.h
@@ -73,20 +73,14 @@ class ResourceManager
setWriteDir(const std::string &path);
/**
- * Adds a directory or archive to the search path.
+ * 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.
*/
void
addToSearchPath(const std::string &path, bool append);
/**
- * Searches for zip files and adds them to the search path.
- */
- void
- searchAndAddArchives(const std::string &path,
- const std::string &ext,
- bool append);
-
- /**
* Creates a directory in the write path
*/
bool