diff options
author | Andrei Karas <akaras@inbox.ru> | 2017-02-10 20:16:03 +0300 |
---|---|---|
committer | Andrei Karas <akaras@inbox.ru> | 2017-02-10 20:47:24 +0300 |
commit | 6c9c56b70db43f4100863d312835fce763698008 (patch) | |
tree | 4a182019f18677c1b71202a79d8f4faceebe05c9 /src/utils/files.cpp | |
parent | 5e7866bd7cc3bf850d9ba3e636d8eca88ac797c7 (diff) | |
download | manaverse-6c9c56b70db43f4100863d312835fce763698008.tar.gz manaverse-6c9c56b70db43f4100863d312835fce763698008.tar.bz2 manaverse-6c9c56b70db43f4100863d312835fce763698008.tar.xz manaverse-6c9c56b70db43f4100863d312835fce763698008.zip |
Rename physfstools into virtfs.
Diffstat (limited to 'src/utils/files.cpp')
-rw-r--r-- | src/utils/files.cpp | 42 |
1 files changed, 21 insertions, 21 deletions
diff --git a/src/utils/files.cpp b/src/utils/files.cpp index fa09f9c7d..e875af770 100644 --- a/src/utils/files.cpp +++ b/src/utils/files.cpp @@ -30,7 +30,7 @@ #include "utils/mkdir.h" #include "utils/paths.h" -#include "utils/physfstools.h" +#include "utils/virtfs.h" #include "utils/stringutils.h" #include <algorithm> @@ -49,14 +49,14 @@ void Files::extractLocale() resourceManager->addToSearchPath(fileName2, Append_false); const std::string localDir = std::string(getenv("APPDIR")).append("/"); - char **rootDirs = PhysFs::enumerateFiles("locale"); + char **rootDirs = VirtFs::enumerateFiles("locale"); for (char **i = rootDirs; *i; i++) { const std::string dir = std::string("locale/").append(*i); - if (PhysFs::isDirectory(dir.c_str())) + if (VirtFs::isDirectory(dir.c_str())) { const std::string moFile = dir + "/LC_MESSAGES/manaplus.mo"; - if (PhysFs::exists((moFile).c_str())) + if (VirtFs::exists((moFile).c_str())) { const std::string localFile = localDir + moFile; const std::string localDir2 = localDir + dir + "/LC_MESSAGES"; @@ -65,7 +65,7 @@ void Files::extractLocale() } } } - PhysFs::freeList(rootDirs); + VirtFs::freeList(rootDirs); resourceManager->removeFromSearchPath(fileName2); remove(fileName2.c_str()); } @@ -91,7 +91,7 @@ void Files::copyPhysFsFile(const std::string &restrict inFile, const std::string &restrict outFile) { int size = 0; - void *const buf = PhysFs::loadFile(inFile, size); + void *const buf = VirtFs::loadFile(inFile, size); FILE *const file = fopen(outFile.c_str(), "w"); fwrite(buf, 1, size, file); fclose(file); @@ -109,17 +109,17 @@ void Files::copyPhysFsDir(const std::string &restrict inDir, const std::string &restrict outDir) { mkdir_r(outDir.c_str()); - char **files = PhysFs::enumerateFiles(inDir.c_str()); + char **files = VirtFs::enumerateFiles(inDir.c_str()); for (char **i = files; *i; i++) { const std::string file = std::string(inDir).append("/").append(*i); const std::string outDir2 = std::string(outDir).append("/").append(*i); - if (PhysFs::isDirectory(file.c_str())) + if (VirtFs::isDirectory(file.c_str())) copyPhysFsDir(file, outDir2); else copyPhysFsFile(file, outDir2); } - PhysFs::freeList(files); + VirtFs::freeList(files); } void Files::extractZip(const std::string &restrict zipName, @@ -211,35 +211,35 @@ int Files::copyFile(const std::string &restrict srcName, void Files::getFiles(const std::string &path, StringVect &list) { - char **const fonts = PhysFs::enumerateFiles(path.c_str()); + char **const fonts = VirtFs::enumerateFiles(path.c_str()); for (char *const *i = fonts; *i; i++) { - if (!PhysFs::isDirectory((path + *i).c_str())) + if (!VirtFs::isDirectory((path + *i).c_str())) list.push_back(*i); } - PhysFs::freeList(fonts); + VirtFs::freeList(fonts); } void Files::getDirs(const std::string &path, StringVect &list) { - char **const fonts = PhysFs::enumerateFiles(path.c_str()); + char **const fonts = VirtFs::enumerateFiles(path.c_str()); for (char *const *i = fonts; *i; i++) { - if (PhysFs::isDirectory((path + *i).c_str())) + if (VirtFs::isDirectory((path + *i).c_str())) list.push_back(*i); } - PhysFs::freeList(fonts); + VirtFs::freeList(fonts); } void Files::getFilesWithDir(const std::string &path, StringVect &list) { - char **const fonts = PhysFs::enumerateFiles(path.c_str()); + char **const fonts = VirtFs::enumerateFiles(path.c_str()); for (char *const *i = fonts; *i; i++) { - if (!PhysFs::isDirectory((path + *i).c_str())) + if (!VirtFs::isDirectory((path + *i).c_str())) list.push_back(path + *i); } - PhysFs::freeList(fonts); + VirtFs::freeList(fonts); } bool Files::existsLocal(const std::string &path) @@ -256,7 +256,7 @@ bool Files::existsLocal(const std::string &path) std::string Files::getPath(const std::string &file) { // get the real path to the file - const char *const tmp = PhysFs::getRealDir(file.c_str()); + const char *const tmp = VirtFs::getRealDir(file.c_str()); std::string path; // if the file is not in the search path, then its nullptr @@ -282,7 +282,7 @@ std::string Files::loadTextFileString(const std::string &fileName) { int contentsLength; char *fileContents = static_cast<char*>( - PhysFs::loadFile(fileName, contentsLength)); + VirtFs::loadFile(fileName, contentsLength)); if (!fileContents) { @@ -299,7 +299,7 @@ bool Files::loadTextFile(const std::string &fileName, { int contentsLength; char *fileContents = static_cast<char*>( - PhysFs::loadFile(fileName, contentsLength)); + VirtFs::loadFile(fileName, contentsLength)); if (!fileContents) { |