diff options
author | Andrei Karas <akaras@inbox.ru> | 2017-02-13 16:00:25 +0300 |
---|---|---|
committer | Andrei Karas <akaras@inbox.ru> | 2017-02-13 16:00:25 +0300 |
commit | 0b3462e73c9ccbfd8bba51b344cc97cc168dfa2d (patch) | |
tree | 7f59ea53ee0fef4b7235d49bf1208be62c0c8424 /src/utils/virtfs.cpp | |
parent | 2bffdca7109c4d8a3d732154cb96d5eec4d9eb6e (diff) | |
download | plus-0b3462e73c9ccbfd8bba51b344cc97cc168dfa2d.tar.gz plus-0b3462e73c9ccbfd8bba51b344cc97cc168dfa2d.tar.bz2 plus-0b3462e73c9ccbfd8bba51b344cc97cc168dfa2d.tar.xz plus-0b3462e73c9ccbfd8bba51b344cc97cc168dfa2d.zip |
Split virtfs.cpp into virtfs.cpp and virtfstools.cpp
Diffstat (limited to 'src/utils/virtfs.cpp')
-rw-r--r-- | src/utils/virtfs.cpp | 74 |
1 files changed, 1 insertions, 73 deletions
diff --git a/src/utils/virtfs.cpp b/src/utils/virtfs.cpp index e5b407f35..2a11d6ba8 100644 --- a/src/utils/virtfs.cpp +++ b/src/utils/virtfs.cpp @@ -193,32 +193,6 @@ namespace VirtFs return PHYSFS_mkdir(dirname); } - void *loadFile(const std::string &fileName, int &fileSize) - { - // Attempt to open the specified file using PhysicsFS - VirtFile *const file = VirtFs::openRead(fileName.c_str()); - - if (!file) - { - logger->log("Warning: Failed to load %s: %s", - fileName.c_str(), - VirtFs::getLastError()); - return nullptr; - } - - logger->log("Loaded %s/%s", - VirtFs::getRealDir(fileName.c_str()), - fileName.c_str()); - - fileSize = CAST_S32(VirtFs::fileLength(file)); - // Allocate memory and load the file - void *const buffer = calloc(fileSize, 1); - VirtFs::read(file, buffer, 1, fileSize); - VirtFs::close(file); - - return buffer; - } - bool deinit() { if (PHYSFS_deinit() != 0) @@ -299,50 +273,4 @@ 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 +} // namespace VirtFs |