diff options
author | Andrei Karas <akaras@inbox.ru> | 2017-05-17 18:21:22 +0300 |
---|---|---|
committer | Andrei Karas <akaras@inbox.ru> | 2017-05-17 18:21:22 +0300 |
commit | cda39ec9d6a0b5fab2c009046cf3570ab90db20b (patch) | |
tree | cd9d1c5a6abb749d81d7f785917ceb6d0525b898 /src/fs/virtfs/fsdir.cpp | |
parent | a9d80dc997f95aa17a12e4d797ecc26072a38edb (diff) | |
download | manaverse-cda39ec9d6a0b5fab2c009046cf3570ab90db20b.tar.gz manaverse-cda39ec9d6a0b5fab2c009046cf3570ab90db20b.tar.bz2 manaverse-cda39ec9d6a0b5fab2c009046cf3570ab90db20b.tar.xz manaverse-cda39ec9d6a0b5fab2c009046cf3570ab90db20b.zip |
Improve a bit virtfs based on directories.
Diffstat (limited to 'src/fs/virtfs/fsdir.cpp')
-rw-r--r-- | src/fs/virtfs/fsdir.cpp | 24 |
1 files changed, 15 insertions, 9 deletions
diff --git a/src/fs/virtfs/fsdir.cpp b/src/fs/virtfs/fsdir.cpp index 37c5cc795..e205e8362 100644 --- a/src/fs/virtfs/fsdir.cpp +++ b/src/fs/virtfs/fsdir.cpp @@ -65,7 +65,8 @@ namespace FsDir const std::string &filename, const FILEMTYPE mode) { - const std::string path = entry->root + entry->subDir + filename; + const std::string path = static_cast<DirEntry*>(entry)->rootSubDir + + filename; if (Files::existsLocal(path) == false) return nullptr; FILEHTYPE fd = FILEOPEN(path.c_str(), @@ -173,7 +174,7 @@ namespace FsDir std::string &realDir) { DirEntry *const dirEntry = static_cast<DirEntry*>(entry); - if (Files::existsLocal(dirEntry->root + entry->subDir + filename)) + if (Files::existsLocal(dirEntry->rootSubDir + filename)) { realDir = dirEntry->userDir; return true; @@ -185,14 +186,16 @@ namespace FsDir std::string fileName, std::string dirName A_UNUSED) { - return Files::existsLocal(entry->root + entry->subDir + fileName); + return Files::existsLocal(static_cast<DirEntry*>(entry)->rootSubDir + + fileName); } void enumerate(FsEntry *restrict const entry, std::string dirName, StringVect &names) { - const std::string path = entry->root + entry->subDir + dirName; + const std::string path = static_cast<DirEntry*>(entry)->rootSubDir + + dirName; const struct dirent *next_file = nullptr; DIR *const dir = opendir(path.c_str()); if (dir) @@ -234,7 +237,7 @@ namespace FsDir std::string dirName, bool &isDirFlag) { - std::string path = entry->root + entry->subDir + dirName; + std::string path = static_cast<DirEntry*>(entry)->rootSubDir + dirName; struct stat statbuf; if (stat(path.c_str(), &statbuf) == 0) @@ -462,7 +465,7 @@ namespace FsDir int &restrict fileSize) { const DirEntry *const dirEntry = static_cast<DirEntry*>(entry); - const std::string path = entry->root + entry->subDir + filename; + const std::string path = dirEntry->rootSubDir + filename; if (Files::existsLocal(path) == false) return nullptr; FILEHTYPE fd = FILEOPEN(path.c_str(), @@ -524,7 +527,8 @@ namespace FsDir std::string dirName, StringVect &names) { - const std::string path = entry->root + entry->subDir + dirName; + const std::string path = static_cast<DirEntry*>(entry)->rootSubDir + + dirName; const struct dirent *next_file = nullptr; DIR *const dir = opendir(path.c_str()); if (dir) @@ -573,7 +577,8 @@ namespace FsDir const std::string &dirName, StringVect &names) { - const std::string path = entry->root + entry->subDir + dirName; + const std::string path = static_cast<DirEntry*>(entry)->rootSubDir + + dirName; const struct dirent *next_file = nullptr; DIR *const dir = opendir(path.c_str()); if (dir) @@ -622,7 +627,8 @@ namespace FsDir std::string dirName, StringVect &names) { - const std::string path = entry->root + entry->subDir + dirName; + const std::string path = static_cast<DirEntry*>(entry)->rootSubDir + + dirName; const struct dirent *next_file = nullptr; DIR *const dir = opendir(path.c_str()); if (dir) |