diff options
author | Andrei Karas <akaras@inbox.ru> | 2017-05-05 18:24:23 +0300 |
---|---|---|
committer | Andrei Karas <akaras@inbox.ru> | 2017-05-05 18:24:23 +0300 |
commit | 35c8306fb26c2989dfff71b9769b1658f34e6afa (patch) | |
tree | 345b7659b541c20068e46aae5125b40458c4970d /src/fs/virtfs | |
parent | 0f1ff357b2c24e16ac96ea4650de6deeb9609485 (diff) | |
download | manaverse-35c8306fb26c2989dfff71b9769b1658f34e6afa.tar.gz manaverse-35c8306fb26c2989dfff71b9769b1658f34e6afa.tar.bz2 manaverse-35c8306fb26c2989dfff71b9769b1658f34e6afa.tar.xz manaverse-35c8306fb26c2989dfff71b9769b1658f34e6afa.zip |
Rename virtfsdir into fsdir.
Diffstat (limited to 'src/fs/virtfs')
-rw-r--r-- | src/fs/virtfs/fs.cpp | 28 | ||||
-rw-r--r-- | src/fs/virtfs/fsdir.cpp (renamed from src/fs/virtfs/virtfsdir.cpp) | 76 | ||||
-rw-r--r-- | src/fs/virtfs/fsdir.h (renamed from src/fs/virtfs/virtfsdir.h) | 4 | ||||
-rw-r--r-- | src/fs/virtfs/virtfsdirrwops.cpp | 12 | ||||
-rw-r--r-- | src/fs/virtfs/virtfsdirrwops.h | 4 |
5 files changed, 62 insertions, 62 deletions
diff --git a/src/fs/virtfs/fs.cpp b/src/fs/virtfs/fs.cpp index e96ad23b4..9c3228775 100644 --- a/src/fs/virtfs/fs.cpp +++ b/src/fs/virtfs/fs.cpp @@ -25,7 +25,7 @@ #include "fs/virtfs/direntry.h" #include "fs/virtfs/file.h" -#include "fs/virtfs/virtfsdir.h" +#include "fs/virtfs/fsdir.h" #include "fs/virtfs/fsfuncs.h" #include "fs/virtfs/virtfszip.h" #include "fs/virtfs/virtlist.h" @@ -55,7 +55,7 @@ namespace VirtFs void init(const std::string &restrict name) { updateDirSeparator(); - VirtFsDir::init(name); + FsDir::init(name); VirtFsZip::init(); } @@ -75,12 +75,12 @@ namespace VirtFs const char *getBaseDir() { - return VirtFsDir::getBaseDir(); + return FsDir::getBaseDir(); } const char *getUserDir() { - return VirtFsDir::getUserDir(); + return FsDir::getUserDir(); } std::vector<FsEntry*> &getEntries() @@ -118,7 +118,7 @@ namespace VirtFs prepareFsPath(name); if (checkPath(name) == false) { - reportAlways("VirtFsDir::exists invalid path: %s", + reportAlways("FsDir::exists invalid path: %s", name.c_str()); return false; } @@ -255,7 +255,7 @@ namespace VirtFs bool isSymbolicLink(const std::string &restrict name) { - return VirtFsDir::isSymbolicLink(name); + return FsDir::isSymbolicLink(name); } void freeList(VirtList *restrict const handle) @@ -322,7 +322,7 @@ namespace VirtFs bool setWriteDir(const std::string &restrict newDir) { - return VirtFsDir::setWriteDir(newDir); + return FsDir::setWriteDir(newDir); } void addEntry(FsEntry *const entry, @@ -339,7 +339,7 @@ namespace VirtFs { if (newDir.find(".zip") != std::string::npos) { - reportAlways("Called VirtFsDir::addToSearchPath with zip archive"); + reportAlways("Called FsDir::addToSearchPath with zip archive"); return false; } std::string rootDir = newDir; @@ -353,7 +353,7 @@ namespace VirtFs return false; } logger->log("Add virtual directory: " + newDir); - addEntry(new DirEntry(newDir, rootDir, VirtFsDir::getFuncs()), + addEntry(new DirEntry(newDir, rootDir, FsDir::getFuncs()), append); return true; } @@ -521,7 +521,7 @@ namespace VirtFs prepareFsPath(fileName); if (checkPath(fileName) == false) { - reportAlways("VirtFsDir::getRealDir invalid path: %s", + reportAlways("FsDir::getRealDir invalid path: %s", fileName.c_str()); return std::string(); } @@ -547,17 +547,17 @@ namespace VirtFs bool mkdir(const std::string &restrict dirname) { - return VirtFsDir::mkdir(dirname); + return FsDir::mkdir(dirname); } bool remove(const std::string &restrict filename) { - return VirtFsDir::remove(filename); + return FsDir::remove(filename); } bool deinit() { - VirtFsDir::deinit(); + FsDir::deinit(); VirtFsZip::deinit(); FOR_EACH (std::vector<FsEntry*>::iterator, it, mEntries) { @@ -575,7 +575,7 @@ namespace VirtFs void permitLinks(const bool val) { - VirtFsDir::permitLinks(val); + FsDir::permitLinks(val); } int close(File *restrict const file) diff --git a/src/fs/virtfs/virtfsdir.cpp b/src/fs/virtfs/fsdir.cpp index f3ef04b9c..516b326db 100644 --- a/src/fs/virtfs/virtfsdir.cpp +++ b/src/fs/virtfs/fsdir.cpp @@ -18,7 +18,7 @@ * along with this program. If not, see <http://www.gnu.org/licenses/>. */ -#include "fs/virtfs/virtfsdir.h" +#include "fs/virtfs/fsdir.h" #include "fs/files.h" #include "fs/mkdir.h" @@ -59,7 +59,7 @@ namespace FsFuncs funcs; } // namespace -namespace VirtFsDir +namespace FsDir { File *openInternal(FsEntry *restrict const entry, const std::string &filename, @@ -125,30 +125,30 @@ namespace VirtFsDir void initFuncs(FsFuncs *restrict const ptr) { - ptr->close = &VirtFsDir::close; - ptr->read = &VirtFsDir::read; - ptr->write = &VirtFsDir::write; - ptr->fileLength = &VirtFsDir::fileLength; - ptr->tell = &VirtFsDir::tell; - ptr->seek = &VirtFsDir::seek; - ptr->eof = &VirtFsDir::eof; - ptr->exists = &VirtFsDir::exists; - ptr->getRealDir = &VirtFsDir::getRealDir; - ptr->enumerate = &VirtFsDir::enumerate; - ptr->isDirectory = &VirtFsDir::isDirectory; - ptr->openRead = &VirtFsDir::openRead; - ptr->openWrite = &VirtFsDir::openWrite; - ptr->openAppend = &VirtFsDir::openAppend; - ptr->loadFile = &VirtFsDir::loadFile; - ptr->getFiles = &VirtFsDir::getFiles; - ptr->getFilesWithDir = &VirtFsDir::getFilesWithDir; - ptr->getDirs = &VirtFsDir::getDirs; - ptr->rwops_seek = &VirtFsDir::rwops_seek; - ptr->rwops_read = &VirtFsDir::rwops_read; - ptr->rwops_write = &VirtFsDir::rwops_write; - ptr->rwops_close = &VirtFsDir::rwops_close; + ptr->close = &FsDir::close; + ptr->read = &FsDir::read; + ptr->write = &FsDir::write; + ptr->fileLength = &FsDir::fileLength; + ptr->tell = &FsDir::tell; + ptr->seek = &FsDir::seek; + ptr->eof = &FsDir::eof; + ptr->exists = &FsDir::exists; + ptr->getRealDir = &FsDir::getRealDir; + ptr->enumerate = &FsDir::enumerate; + ptr->isDirectory = &FsDir::isDirectory; + ptr->openRead = &FsDir::openRead; + ptr->openWrite = &FsDir::openWrite; + ptr->openAppend = &FsDir::openAppend; + ptr->loadFile = &FsDir::loadFile; + ptr->getFiles = &FsDir::getFiles; + ptr->getFilesWithDir = &FsDir::getFilesWithDir; + ptr->getDirs = &FsDir::getDirs; + ptr->rwops_seek = &FsDir::rwops_seek; + ptr->rwops_read = &FsDir::rwops_read; + ptr->rwops_write = &FsDir::rwops_write; + ptr->rwops_close = &FsDir::rwops_close; #ifdef USE_SDL2 - ptr->rwops_size = &VirtFsDir::rwops_size; + ptr->rwops_size = &FsDir::rwops_size; #endif // USE_SDL2 } @@ -250,7 +250,7 @@ namespace VirtFsDir prepareFsPath(name); if (checkPath(name) == false) { - reportAlways("VirtFsDir::isSymbolicLink invalid path: %s", + reportAlways("FsDir::isSymbolicLink invalid path: %s", name.c_str()); return false; } @@ -285,7 +285,7 @@ namespace VirtFsDir prepareFsPath(dirname); if (mWriteDir.empty()) { - reportAlways("VirtFsDir::mkdir write dir is empty"); + reportAlways("FsDir::mkdir write dir is empty"); return false; } return mkdir_r((mWriteDir + dirname).c_str()) != -1; @@ -296,7 +296,7 @@ namespace VirtFsDir prepareFsPath(filename); if (mWriteDir.empty()) { - reportAlways("VirtFsDir::remove write dir is empty"); + reportAlways("FsDir::remove write dir is empty"); return false; } return ::remove((mWriteDir + filename).c_str()) != 0; @@ -325,7 +325,7 @@ namespace VirtFsDir FILEHTYPE fd = file->mFd; if (fd == FILEHDEFAULT) { - reportAlways("VirtFsDir::read file not opened."); + reportAlways("FsDir::read file not opened."); return 0; } #ifdef USE_FILE_FOPEN @@ -349,7 +349,7 @@ namespace VirtFsDir FILEHTYPE fd = file->mFd; if (fd == FILEHDEFAULT) { - reportAlways("VirtFsDir::write file not opened."); + reportAlways("FsDir::write file not opened."); return 0; } #ifdef USE_FILE_FOPEN @@ -370,7 +370,7 @@ namespace VirtFsDir FILEHTYPE fd = file->mFd; if (fd == FILEHDEFAULT) { - reportAlways("VirtFsDir::fileLength file not opened."); + reportAlways("FsDir::fileLength file not opened."); return 0; } #ifdef USE_FILE_FOPEN @@ -383,7 +383,7 @@ namespace VirtFsDir struct stat statbuf; if (fstat(fd, &statbuf) == -1) { - reportAlways("VirtFsDir::fileLength error."); + reportAlways("FsDir::fileLength error."); return -1; } return static_cast<int64_t>(statbuf.st_size); @@ -398,7 +398,7 @@ namespace VirtFsDir FILEHTYPE fd = file->mFd; if (fd == FILEHDEFAULT) { - reportAlways("VirtFsDir::tell file not opened."); + reportAlways("FsDir::tell file not opened."); return 0; } #ifdef USE_FILE_FOPEN @@ -418,7 +418,7 @@ namespace VirtFsDir FILEHTYPE fd = file->mFd; if (fd == FILEHDEFAULT) { - reportAlways("VirtFsDir::seek file not opened."); + reportAlways("FsDir::seek file not opened."); return 0; } const int64_t res = FILESEEK(fd, pos, SEEK_SET); @@ -435,7 +435,7 @@ namespace VirtFsDir FILEHTYPE fd = file->mFd; if (fd == FILEHDEFAULT) { - reportAlways("VirtFsDir::eof file not opened."); + reportAlways("FsDir::eof file not opened."); return 0; } #ifdef USE_FILE_FOPEN @@ -449,7 +449,7 @@ namespace VirtFsDir struct stat statbuf; if (fstat(fd, &statbuf) == -1) { - reportAlways("VirtFsDir::fileLength error."); + reportAlways("FsDir::fileLength error."); return -1; } const int64_t len = static_cast<int64_t>(statbuf.st_size); @@ -487,7 +487,7 @@ namespace VirtFsDir struct stat statbuf; if (fstat(fd, &statbuf) == -1) { - reportAlways("VirtFsDir::fileLength error."); + reportAlways("FsDir::fileLength error."); if (fd != FILEHDEFAULT) FILECLOSE(fd); return nullptr; @@ -666,6 +666,6 @@ namespace VirtFsDir closedir(dir); } } -} // namespace VirtFsDir +} // namespace FsDir } // namespace VirtFs diff --git a/src/fs/virtfs/virtfsdir.h b/src/fs/virtfs/fsdir.h index 509b843d4..1abb46211 100644 --- a/src/fs/virtfs/virtfsdir.h +++ b/src/fs/virtfs/fsdir.h @@ -35,7 +35,7 @@ struct FsEntry; struct FsFuncs; struct VirtList; -namespace VirtFsDir +namespace FsDir { File *openInternal(FsEntry *restrict const entry, const std::string &filename, @@ -97,7 +97,7 @@ namespace VirtFsDir const char *loadFile(FsEntry *restrict const entry, const std::string &restrict fileName, int &restrict fileSize); -} // namespace VirtFsDir +} // namespace FsDir } // namespace VirtFs diff --git a/src/fs/virtfs/virtfsdirrwops.cpp b/src/fs/virtfs/virtfsdirrwops.cpp index 692d107cd..f9855e969 100644 --- a/src/fs/virtfs/virtfsdirrwops.cpp +++ b/src/fs/virtfs/virtfsdirrwops.cpp @@ -31,7 +31,7 @@ namespace VirtFs { -namespace VirtFsDir +namespace FsDir { RWOPSINT rwops_seek(SDL_RWops *const rw, const RWOPSINT offset, @@ -88,7 +88,7 @@ namespace VirtFsDir struct stat statbuf; if (fstat(fd, &statbuf) == -1) { - reportAlways("VirtFsDir::fileLength error."); + reportAlways("FsDir::fileLength error."); len = -1; } else @@ -172,7 +172,7 @@ namespace VirtFsDir struct stat statbuf; if (fstat(fd, &statbuf) == -1) { - reportAlways("VirtFsDir::fileLength error."); + reportAlways("FsDir::fileLength error."); return CAST_S32(rc); } #endif // USE_FILE_FOPEN @@ -208,7 +208,7 @@ namespace VirtFsDir struct stat statbuf; if (fstat(fd, &statbuf) == -1) { - reportAlways("VirtFsDir::fileLength error."); + reportAlways("FsDir::fileLength error."); return CAST_S32(rc); } #endif // USE_FILE_FOPEN @@ -243,7 +243,7 @@ namespace VirtFsDir struct stat statbuf; if (fstat(fd, &statbuf) == -1) { - reportAlways("VirtFsDir::fileLength error."); + reportAlways("FsDir::fileLength error."); return -1; } return static_cast<int64_t>(statbuf.st_size); @@ -251,6 +251,6 @@ namespace VirtFsDir } #endif // USE_SDL2 -} // namespace VirtFsDir +} // namespace FsDir } // namespace VirtFs diff --git a/src/fs/virtfs/virtfsdirrwops.h b/src/fs/virtfs/virtfsdirrwops.h index 4369c5eb1..1f20d97df 100644 --- a/src/fs/virtfs/virtfsdirrwops.h +++ b/src/fs/virtfs/virtfsdirrwops.h @@ -30,7 +30,7 @@ struct SDL_RWops; namespace VirtFs { -namespace VirtFsDir +namespace FsDir { RWOPSINT rwops_seek(SDL_RWops *const rw, const RWOPSINT offset, @@ -48,7 +48,7 @@ namespace VirtFsDir RWOPSINT rwops_size(SDL_RWops *const rw); #endif // USE_SDL2 -} // namespace VirtFsDir +} // namespace FsDir } // namespace VirtFs |