summaryrefslogtreecommitdiff
path: root/src/fs/virtfileprivate.cpp
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2017-02-23 01:06:11 +0300
committerAndrei Karas <akaras@inbox.ru>2017-02-23 01:06:11 +0300
commit2b6106c41f3959d4deb8efc58c9055de0339959e (patch)
tree2ae271cd59997d4fe128e0173c0224e28417b34b /src/fs/virtfileprivate.cpp
parent76667ef0fa911fc8bf37df72896645dbfbbc0763 (diff)
downloadplus-2b6106c41f3959d4deb8efc58c9055de0339959e.tar.gz
plus-2b6106c41f3959d4deb8efc58c9055de0339959e.tar.bz2
plus-2b6106c41f3959d4deb8efc58c9055de0339959e.tar.xz
plus-2b6106c41f3959d4deb8efc58c9055de0339959e.zip
Impliment basic VirtFsDir for virtual fs based on directories.
Api similar to VirtFs. VirtFsDir unused for now.
Diffstat (limited to 'src/fs/virtfileprivate.cpp')
-rw-r--r--src/fs/virtfileprivate.cpp16
1 files changed, 14 insertions, 2 deletions
diff --git a/src/fs/virtfileprivate.cpp b/src/fs/virtfileprivate.cpp
index 6bd5d3b9a..1dcc6116c 100644
--- a/src/fs/virtfileprivate.cpp
+++ b/src/fs/virtfileprivate.cpp
@@ -20,15 +20,25 @@
#include "fs/virtfileprivate.h"
+#include <unistd.h>
+
#include "debug.h"
VirtFilePrivate::VirtFilePrivate() :
- mFile(nullptr)
+ mFile(nullptr),
+ mFd(-1)
+{
+}
+
+VirtFilePrivate::VirtFilePrivate(const int fd) :
+ mFile(nullptr),
+ mFd(fd)
{
}
VirtFilePrivate::VirtFilePrivate(PHYSFS_file *const file) :
- mFile(file)
+ mFile(file),
+ mFd(-1)
{
}
@@ -39,4 +49,6 @@ VirtFilePrivate::~VirtFilePrivate()
PHYSFS_close(mFile);
mFile = nullptr;
}
+ if (mFd != -1)
+ close(mFd);
}