summaryrefslogtreecommitdiff
path: root/src/utils/virtfs.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/utils/virtfs.cpp')
-rw-r--r--src/utils/virtfs.cpp46
1 files changed, 46 insertions, 0 deletions
diff --git a/src/utils/virtfs.cpp b/src/utils/virtfs.cpp
index 0ab3b668f..e5b407f35 100644
--- a/src/utils/virtfs.cpp
+++ b/src/utils/virtfs.cpp
@@ -299,4 +299,50 @@ namespace VirtFs
{
return PHYSFS_eof(file->mPrivate->mFile);
}
+
+ void searchAndAddArchives(const std::string &restrict path,
+ const std::string &restrict ext,
+ const Append append)
+ {
+ char **list = VirtFs::enumerateFiles(path.c_str());
+
+ for (char **i = list; *i; i++)
+ {
+ const size_t len = strlen(*i);
+
+ if (len > ext.length() &&
+ !ext.compare((*i) + (len - ext.length())))
+ {
+ const std::string file = path + (*i);
+ const std::string realPath = std::string(
+ VirtFs::getRealDir(file.c_str()));
+ VirtFs::addZipToSearchPath(std::string(realPath).append(
+ dirSeparator).append(file), append);
+ }
+ }
+ VirtFs::freeList(list);
+ }
+
+ void searchAndRemoveArchives(const std::string &restrict path,
+ const std::string &restrict ext)
+ {
+ char **list = VirtFs::enumerateFiles(path.c_str());
+
+ for (char **i = list; *i; i++)
+ {
+ const size_t len = strlen(*i);
+ if (len > ext.length() &&
+ !ext.compare((*i) + (len - ext.length())))
+ {
+ const std::string file = path + (*i);
+ const std::string realPath = std::string(
+ VirtFs::getRealDir(file.c_str()));
+ VirtFs::removeZipFromSearchPath(std::string(
+ realPath).append(
+ dirSeparator).append(
+ file));
+ }
+ }
+ VirtFs::freeList(list);
+ }
} // namespace PhysFs