summaryrefslogtreecommitdiff
path: root/src/fs/virtfsdir.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/fs/virtfsdir.cpp')
-rw-r--r--src/fs/virtfsdir.cpp20
1 files changed, 19 insertions, 1 deletions
diff --git a/src/fs/virtfsdir.cpp b/src/fs/virtfsdir.cpp
index 249317773..3950aa18c 100644
--- a/src/fs/virtfsdir.cpp
+++ b/src/fs/virtfsdir.cpp
@@ -27,6 +27,7 @@
#include "fs/virtfs.h"
#include "fs/virtfile.h"
#include "fs/virtfileprivate.h"
+#include "fs/virtfsfuncs.h"
#include "fs/virtlist.h"
#include "utils/checkutils.h"
@@ -50,6 +51,7 @@ namespace
std::vector<VirtDirEntry*> mEntries;
std::string mWriteDir;
bool mPermitLinks = false;
+ VirtFsFuncs funcs;
} // namespace
namespace VirtFsDir
@@ -79,7 +81,7 @@ namespace VirtFsDir
filename.c_str());
return nullptr;
}
- VirtFile *restrict const file = new VirtFile;
+ VirtFile *restrict const file = new VirtFile(&funcs);
file->mPrivate = new VirtFilePrivate(fd);
return file;
@@ -250,6 +252,22 @@ namespace VirtFsDir
mEntries.clear();
}
+ void init()
+ {
+ initFuncs(&funcs);
+ }
+
+ void initFuncs(VirtFsFuncs *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;
+ }
+
std::string getRealDir(const std::string &restrict filename)
{
if (checkPath(filename) == false)